001package org.hl7.fhir.dstu3.formats;
002
003import java.io.IOException;
004
005
006
007/*
008  Copyright (c) 2011+, HL7, Inc.
009  All rights reserved.
010  
011  Redistribution and use in source and binary forms, with or without modification, 
012  are permitted provided that the following conditions are met:
013  
014   * Redistributions of source code must retain the above copyright notice, this 
015     list of conditions and the following disclaimer.
016   * Redistributions in binary form must reproduce the above copyright notice, 
017     this list of conditions and the following disclaimer in the documentation 
018     and/or other materials provided with the distribution.
019   * Neither the name of HL7 nor the names of its contributors may be used to 
020     endorse or promote products derived from this software without specific 
021     prior written permission.
022  
023  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
024  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
025  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
026  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
027  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
028  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
029  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
030  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
031  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
032  POSSIBILITY OF SUCH DAMAGE.
033  
034*/
035
036// Generated on Mon, Apr 17, 2017 08:38+1000 for FHIR v3.0.x
037import org.hl7.fhir.dstu3.model.*;
038import org.hl7.fhir.exceptions.FHIRFormatError;
039import org.hl7.fhir.utilities.Utilities;
040import org.hl7.fhir.utilities.xhtml.XhtmlNode;
041
042import com.google.gson.JsonArray;
043import com.google.gson.JsonObject;
044
045public class JsonParser extends JsonParserBase {
046
047  public JsonParser() {
048    super();
049  }
050
051  public JsonParser(boolean allowUnknownContent) {
052    super();
053    setAllowUnknownContent(allowUnknownContent);
054  }
055
056
057  protected void parseElementProperties(JsonObject json, Element element) throws IOException, FHIRFormatError {
058    super.parseElementProperties(json, element);
059    if (json.has("extension")) {
060      JsonArray array = json.getAsJsonArray("extension");
061      for (int i = 0; i < array.size(); i++) {
062        element.getExtension().add(parseExtension(array.get(i).getAsJsonObject()));
063      }
064    };
065  }
066
067  protected void parseBackboneProperties(JsonObject json, BackboneElement element) throws IOException, FHIRFormatError {
068    parseElementProperties(json, element);
069    if (json.has("modifierExtension")) {
070      JsonArray array = json.getAsJsonArray("modifierExtension");
071      for (int i = 0; i < array.size(); i++) {
072        element.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
073      }
074    }
075  }
076
077  protected void parseTypeProperties(JsonObject json, Element element) throws IOException, FHIRFormatError {
078    parseElementProperties(json, element);
079  }
080
081  @SuppressWarnings("unchecked")
082  protected <E extends Enum<E>> Enumeration<E> parseEnumeration(String s, E item, EnumFactory e) throws IOException, FHIRFormatError {
083    Enumeration<E> res = new Enumeration<E>(e);
084    if (s != null)
085      res.setValue((E) e.fromCode(s));
086    return res;
087  }
088
089  protected DateType parseDate(String v) throws IOException, FHIRFormatError {
090    DateType res = new DateType(v);
091    return res;
092  }
093
094  protected DateTimeType parseDateTime(String v) throws IOException, FHIRFormatError {
095    DateTimeType res = new DateTimeType(v);
096    return res;
097  }
098
099  protected CodeType parseCode(String v) throws IOException, FHIRFormatError {
100    CodeType res = new CodeType(v);
101    return res;
102  }
103
104  protected StringType parseString(String v) throws IOException, FHIRFormatError {
105    StringType res = new StringType(v);
106    return res;
107  }
108
109  protected IntegerType parseInteger(java.lang.Long v) throws IOException, FHIRFormatError {
110    IntegerType res = new IntegerType(v);
111    return res;
112  }
113
114  protected OidType parseOid(String v) throws IOException, FHIRFormatError {
115    OidType res = new OidType(v);
116    return res;
117  }
118
119  protected UriType parseUri(String v) throws IOException, FHIRFormatError {
120    UriType res = new UriType(v);
121    return res;
122  }
123
124  protected UuidType parseUuid(String v) throws IOException, FHIRFormatError {
125    UuidType res = new UuidType(v);
126    return res;
127  }
128
129  protected InstantType parseInstant(String v) throws IOException, FHIRFormatError {
130    InstantType res = new InstantType(v);
131    return res;
132  }
133
134  protected BooleanType parseBoolean(java.lang.Boolean v) throws IOException, FHIRFormatError {
135    BooleanType res = new BooleanType(v);
136    return res;
137  }
138
139  protected Base64BinaryType parseBase64Binary(String v) throws IOException, FHIRFormatError {
140    Base64BinaryType res = new Base64BinaryType(v);
141    return res;
142  }
143
144  protected UnsignedIntType parseUnsignedInt(String v) throws IOException, FHIRFormatError {
145    UnsignedIntType res = new UnsignedIntType(v);
146    return res;
147  }
148
149  protected MarkdownType parseMarkdown(String v) throws IOException, FHIRFormatError {
150    MarkdownType res = new MarkdownType(v);
151    return res;
152  }
153
154  protected TimeType parseTime(String v) throws IOException, FHIRFormatError {
155    TimeType res = new TimeType(v);
156    return res;
157  }
158
159  protected IdType parseId(String v) throws IOException, FHIRFormatError {
160    IdType res = new IdType(v);
161    return res;
162  }
163
164  protected PositiveIntType parsePositiveInt(String v) throws IOException, FHIRFormatError {
165    PositiveIntType res = new PositiveIntType(v);
166    return res;
167  }
168
169  protected DecimalType parseDecimal(java.math.BigDecimal v) throws IOException, FHIRFormatError {
170    DecimalType res = new DecimalType(v);
171    return res;
172  }
173
174  protected Extension parseExtension(JsonObject json) throws IOException, FHIRFormatError {
175    Extension res = new Extension();
176    parseExtensionProperties(json, res);
177    return res;
178  }
179
180  protected void parseExtensionProperties(JsonObject json, Extension res) throws IOException, FHIRFormatError {
181    parseTypeProperties(json, res);
182    if (json.has("url"))
183      res.setUrlElement(parseUri(json.get("url").getAsString()));
184    if (json.has("_url"))
185      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
186    Type value = parseType("value", json);
187    if (value != null)
188      res.setValue(value);
189  }
190
191  protected Narrative parseNarrative(JsonObject json) throws IOException, FHIRFormatError {
192    Narrative res = new Narrative();
193    parseNarrativeProperties(json, res);
194    return res;
195  }
196
197  protected void parseNarrativeProperties(JsonObject json, Narrative res) throws IOException, FHIRFormatError {
198    parseTypeProperties(json, res);
199    if (json.has("status"))
200      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Narrative.NarrativeStatus.NULL, new Narrative.NarrativeStatusEnumFactory()));
201    if (json.has("_status"))
202      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
203    if (json.has("div"))
204      res.setDiv(parseXhtml(json.get("div").getAsString()));
205  }
206
207  protected Reference parseReference(JsonObject json) throws IOException, FHIRFormatError {
208    Reference res = new Reference();
209    parseReferenceProperties(json, res);
210    return res;
211  }
212
213  protected void parseReferenceProperties(JsonObject json, Reference res) throws IOException, FHIRFormatError {
214    parseTypeProperties(json, res);
215    if (json.has("reference"))
216      res.setReferenceElement(parseString(json.get("reference").getAsString()));
217    if (json.has("_reference"))
218      parseElementProperties(getJObject(json, "_reference"), res.getReferenceElement());
219    if (json.has("identifier"))
220      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
221    if (json.has("display"))
222      res.setDisplayElement(parseString(json.get("display").getAsString()));
223    if (json.has("_display"))
224      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
225  }
226
227  protected Quantity parseQuantity(JsonObject json) throws IOException, FHIRFormatError {
228    Quantity res = new Quantity();
229    parseQuantityProperties(json, res);
230    return res;
231  }
232
233  protected void parseQuantityProperties(JsonObject json, Quantity res) throws IOException, FHIRFormatError {
234    parseTypeProperties(json, res);
235    if (json.has("value"))
236      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
237    if (json.has("_value"))
238      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
239    if (json.has("comparator"))
240      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
241    if (json.has("_comparator"))
242      parseElementProperties(getJObject(json, "_comparator"), res.getComparatorElement());
243    if (json.has("unit"))
244      res.setUnitElement(parseString(json.get("unit").getAsString()));
245    if (json.has("_unit"))
246      parseElementProperties(getJObject(json, "_unit"), res.getUnitElement());
247    if (json.has("system"))
248      res.setSystemElement(parseUri(json.get("system").getAsString()));
249    if (json.has("_system"))
250      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
251    if (json.has("code"))
252      res.setCodeElement(parseCode(json.get("code").getAsString()));
253    if (json.has("_code"))
254      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
255  }
256
257  protected Period parsePeriod(JsonObject json) throws IOException, FHIRFormatError {
258    Period res = new Period();
259    parsePeriodProperties(json, res);
260    return res;
261  }
262
263  protected void parsePeriodProperties(JsonObject json, Period res) throws IOException, FHIRFormatError {
264    parseTypeProperties(json, res);
265    if (json.has("start"))
266      res.setStartElement(parseDateTime(json.get("start").getAsString()));
267    if (json.has("_start"))
268      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
269    if (json.has("end"))
270      res.setEndElement(parseDateTime(json.get("end").getAsString()));
271    if (json.has("_end"))
272      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
273  }
274
275  protected Attachment parseAttachment(JsonObject json) throws IOException, FHIRFormatError {
276    Attachment res = new Attachment();
277    parseAttachmentProperties(json, res);
278    return res;
279  }
280
281  protected void parseAttachmentProperties(JsonObject json, Attachment res) throws IOException, FHIRFormatError {
282    parseTypeProperties(json, res);
283    if (json.has("contentType"))
284      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
285    if (json.has("_contentType"))
286      parseElementProperties(getJObject(json, "_contentType"), res.getContentTypeElement());
287    if (json.has("language"))
288      res.setLanguageElement(parseCode(json.get("language").getAsString()));
289    if (json.has("_language"))
290      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
291    if (json.has("data"))
292      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
293    if (json.has("_data"))
294      parseElementProperties(getJObject(json, "_data"), res.getDataElement());
295    if (json.has("url"))
296      res.setUrlElement(parseUri(json.get("url").getAsString()));
297    if (json.has("_url"))
298      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
299    if (json.has("size"))
300      res.setSizeElement(parseUnsignedInt(json.get("size").getAsString()));
301    if (json.has("_size"))
302      parseElementProperties(getJObject(json, "_size"), res.getSizeElement());
303    if (json.has("hash"))
304      res.setHashElement(parseBase64Binary(json.get("hash").getAsString()));
305    if (json.has("_hash"))
306      parseElementProperties(getJObject(json, "_hash"), res.getHashElement());
307    if (json.has("title"))
308      res.setTitleElement(parseString(json.get("title").getAsString()));
309    if (json.has("_title"))
310      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
311    if (json.has("creation"))
312      res.setCreationElement(parseDateTime(json.get("creation").getAsString()));
313    if (json.has("_creation"))
314      parseElementProperties(getJObject(json, "_creation"), res.getCreationElement());
315  }
316
317  protected Duration parseDuration(JsonObject json) throws IOException, FHIRFormatError {
318    Duration res = new Duration();
319    parseDurationProperties(json, res);
320    return res;
321  }
322
323  protected void parseDurationProperties(JsonObject json, Duration res) throws IOException, FHIRFormatError {
324    parseQuantityProperties(json, res);
325  }
326
327  protected Count parseCount(JsonObject json) throws IOException, FHIRFormatError {
328    Count res = new Count();
329    parseCountProperties(json, res);
330    return res;
331  }
332
333  protected void parseCountProperties(JsonObject json, Count res) throws IOException, FHIRFormatError {
334    parseQuantityProperties(json, res);
335  }
336
337  protected Range parseRange(JsonObject json) throws IOException, FHIRFormatError {
338    Range res = new Range();
339    parseRangeProperties(json, res);
340    return res;
341  }
342
343  protected void parseRangeProperties(JsonObject json, Range res) throws IOException, FHIRFormatError {
344    parseTypeProperties(json, res);
345    if (json.has("low"))
346      res.setLow(parseSimpleQuantity(getJObject(json, "low")));
347    if (json.has("high"))
348      res.setHigh(parseSimpleQuantity(getJObject(json, "high")));
349  }
350
351  protected Annotation parseAnnotation(JsonObject json) throws IOException, FHIRFormatError {
352    Annotation res = new Annotation();
353    parseAnnotationProperties(json, res);
354    return res;
355  }
356
357  protected void parseAnnotationProperties(JsonObject json, Annotation res) throws IOException, FHIRFormatError {
358    parseTypeProperties(json, res);
359    Type author = parseType("author", json);
360    if (author != null)
361      res.setAuthor(author);
362    if (json.has("time"))
363      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
364    if (json.has("_time"))
365      parseElementProperties(getJObject(json, "_time"), res.getTimeElement());
366    if (json.has("text"))
367      res.setTextElement(parseString(json.get("text").getAsString()));
368    if (json.has("_text"))
369      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
370  }
371
372  protected Money parseMoney(JsonObject json) throws IOException, FHIRFormatError {
373    Money res = new Money();
374    parseMoneyProperties(json, res);
375    return res;
376  }
377
378  protected void parseMoneyProperties(JsonObject json, Money res) throws IOException, FHIRFormatError {
379    parseQuantityProperties(json, res);
380  }
381
382  protected Identifier parseIdentifier(JsonObject json) throws IOException, FHIRFormatError {
383    Identifier res = new Identifier();
384    parseIdentifierProperties(json, res);
385    return res;
386  }
387
388  protected void parseIdentifierProperties(JsonObject json, Identifier res) throws IOException, FHIRFormatError {
389    parseTypeProperties(json, res);
390    if (json.has("use"))
391      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Identifier.IdentifierUse.NULL, new Identifier.IdentifierUseEnumFactory()));
392    if (json.has("_use"))
393      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
394    if (json.has("type"))
395      res.setType(parseCodeableConcept(getJObject(json, "type")));
396    if (json.has("system"))
397      res.setSystemElement(parseUri(json.get("system").getAsString()));
398    if (json.has("_system"))
399      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
400    if (json.has("value"))
401      res.setValueElement(parseString(json.get("value").getAsString()));
402    if (json.has("_value"))
403      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
404    if (json.has("period"))
405      res.setPeriod(parsePeriod(getJObject(json, "period")));
406    if (json.has("assigner"))
407      res.setAssigner(parseReference(getJObject(json, "assigner")));
408  }
409
410  protected Coding parseCoding(JsonObject json) throws IOException, FHIRFormatError {
411    Coding res = new Coding();
412    parseCodingProperties(json, res);
413    return res;
414  }
415
416  protected void parseCodingProperties(JsonObject json, Coding res) throws IOException, FHIRFormatError {
417    parseTypeProperties(json, res);
418    if (json.has("system"))
419      res.setSystemElement(parseUri(json.get("system").getAsString()));
420    if (json.has("_system"))
421      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
422    if (json.has("version"))
423      res.setVersionElement(parseString(json.get("version").getAsString()));
424    if (json.has("_version"))
425      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
426    if (json.has("code"))
427      res.setCodeElement(parseCode(json.get("code").getAsString()));
428    if (json.has("_code"))
429      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
430    if (json.has("display"))
431      res.setDisplayElement(parseString(json.get("display").getAsString()));
432    if (json.has("_display"))
433      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
434    if (json.has("userSelected"))
435      res.setUserSelectedElement(parseBoolean(json.get("userSelected").getAsBoolean()));
436    if (json.has("_userSelected"))
437      parseElementProperties(getJObject(json, "_userSelected"), res.getUserSelectedElement());
438  }
439
440  protected Signature parseSignature(JsonObject json) throws IOException, FHIRFormatError {
441    Signature res = new Signature();
442    parseSignatureProperties(json, res);
443    return res;
444  }
445
446  protected void parseSignatureProperties(JsonObject json, Signature res) throws IOException, FHIRFormatError {
447    parseTypeProperties(json, res);
448    if (json.has("type")) {
449      JsonArray array = json.getAsJsonArray("type");
450      for (int i = 0; i < array.size(); i++) {
451        res.getType().add(parseCoding(array.get(i).getAsJsonObject()));
452      }
453    };
454    if (json.has("when"))
455      res.setWhenElement(parseInstant(json.get("when").getAsString()));
456    if (json.has("_when"))
457      parseElementProperties(getJObject(json, "_when"), res.getWhenElement());
458    Type who = parseType("who", json);
459    if (who != null)
460      res.setWho(who);
461    Type onBehalfOf = parseType("onBehalfOf", json);
462    if (onBehalfOf != null)
463      res.setOnBehalfOf(onBehalfOf);
464    if (json.has("contentType"))
465      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
466    if (json.has("_contentType"))
467      parseElementProperties(getJObject(json, "_contentType"), res.getContentTypeElement());
468    if (json.has("blob"))
469      res.setBlobElement(parseBase64Binary(json.get("blob").getAsString()));
470    if (json.has("_blob"))
471      parseElementProperties(getJObject(json, "_blob"), res.getBlobElement());
472  }
473
474  protected SampledData parseSampledData(JsonObject json) throws IOException, FHIRFormatError {
475    SampledData res = new SampledData();
476    parseSampledDataProperties(json, res);
477    return res;
478  }
479
480  protected void parseSampledDataProperties(JsonObject json, SampledData res) throws IOException, FHIRFormatError {
481    parseTypeProperties(json, res);
482    if (json.has("origin"))
483      res.setOrigin(parseSimpleQuantity(getJObject(json, "origin")));
484    if (json.has("period"))
485      res.setPeriodElement(parseDecimal(json.get("period").getAsBigDecimal()));
486    if (json.has("_period"))
487      parseElementProperties(getJObject(json, "_period"), res.getPeriodElement());
488    if (json.has("factor"))
489      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
490    if (json.has("_factor"))
491      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
492    if (json.has("lowerLimit"))
493      res.setLowerLimitElement(parseDecimal(json.get("lowerLimit").getAsBigDecimal()));
494    if (json.has("_lowerLimit"))
495      parseElementProperties(getJObject(json, "_lowerLimit"), res.getLowerLimitElement());
496    if (json.has("upperLimit"))
497      res.setUpperLimitElement(parseDecimal(json.get("upperLimit").getAsBigDecimal()));
498    if (json.has("_upperLimit"))
499      parseElementProperties(getJObject(json, "_upperLimit"), res.getUpperLimitElement());
500    if (json.has("dimensions"))
501      res.setDimensionsElement(parsePositiveInt(json.get("dimensions").getAsString()));
502    if (json.has("_dimensions"))
503      parseElementProperties(getJObject(json, "_dimensions"), res.getDimensionsElement());
504    if (json.has("data"))
505      res.setDataElement(parseString(json.get("data").getAsString()));
506    if (json.has("_data"))
507      parseElementProperties(getJObject(json, "_data"), res.getDataElement());
508  }
509
510  protected Ratio parseRatio(JsonObject json) throws IOException, FHIRFormatError {
511    Ratio res = new Ratio();
512    parseRatioProperties(json, res);
513    return res;
514  }
515
516  protected void parseRatioProperties(JsonObject json, Ratio res) throws IOException, FHIRFormatError {
517    parseTypeProperties(json, res);
518    if (json.has("numerator"))
519      res.setNumerator(parseQuantity(getJObject(json, "numerator")));
520    if (json.has("denominator"))
521      res.setDenominator(parseQuantity(getJObject(json, "denominator")));
522  }
523
524  protected Distance parseDistance(JsonObject json) throws IOException, FHIRFormatError {
525    Distance res = new Distance();
526    parseDistanceProperties(json, res);
527    return res;
528  }
529
530  protected void parseDistanceProperties(JsonObject json, Distance res) throws IOException, FHIRFormatError {
531    parseQuantityProperties(json, res);
532  }
533
534  protected Age parseAge(JsonObject json) throws IOException, FHIRFormatError {
535    Age res = new Age();
536    parseAgeProperties(json, res);
537    return res;
538  }
539
540  protected void parseAgeProperties(JsonObject json, Age res) throws IOException, FHIRFormatError {
541    parseQuantityProperties(json, res);
542  }
543
544  protected CodeableConcept parseCodeableConcept(JsonObject json) throws IOException, FHIRFormatError {
545    CodeableConcept res = new CodeableConcept();
546    parseCodeableConceptProperties(json, res);
547    return res;
548  }
549
550  protected void parseCodeableConceptProperties(JsonObject json, CodeableConcept res) throws IOException, FHIRFormatError {
551    parseTypeProperties(json, res);
552    if (json.has("coding")) {
553      JsonArray array = json.getAsJsonArray("coding");
554      for (int i = 0; i < array.size(); i++) {
555        res.getCoding().add(parseCoding(array.get(i).getAsJsonObject()));
556      }
557    };
558    if (json.has("text"))
559      res.setTextElement(parseString(json.get("text").getAsString()));
560    if (json.has("_text"))
561      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
562  }
563
564  protected SimpleQuantity parseSimpleQuantity(JsonObject json) throws IOException, FHIRFormatError {
565    SimpleQuantity res = new SimpleQuantity();
566    parseSimpleQuantityProperties(json, res);
567    return res;
568  }
569
570  protected void parseSimpleQuantityProperties(JsonObject json, SimpleQuantity res) throws IOException, FHIRFormatError {
571    parseTypeProperties(json, res);
572    if (json.has("value"))
573      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
574    if (json.has("_value"))
575      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
576    if (json.has("comparator"))
577      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
578    if (json.has("_comparator"))
579      parseElementProperties(getJObject(json, "_comparator"), res.getComparatorElement());
580    if (json.has("unit"))
581      res.setUnitElement(parseString(json.get("unit").getAsString()));
582    if (json.has("_unit"))
583      parseElementProperties(getJObject(json, "_unit"), res.getUnitElement());
584    if (json.has("system"))
585      res.setSystemElement(parseUri(json.get("system").getAsString()));
586    if (json.has("_system"))
587      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
588    if (json.has("code"))
589      res.setCodeElement(parseCode(json.get("code").getAsString()));
590    if (json.has("_code"))
591      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
592  }
593
594  protected Meta parseMeta(JsonObject json) throws IOException, FHIRFormatError {
595    Meta res = new Meta();
596    parseMetaProperties(json, res);
597    return res;
598  }
599
600  protected void parseMetaProperties(JsonObject json, Meta res) throws IOException, FHIRFormatError {
601    parseElementProperties(json, res);
602    if (json.has("versionId"))
603      res.setVersionIdElement(parseId(json.get("versionId").getAsString()));
604    if (json.has("_versionId"))
605      parseElementProperties(getJObject(json, "_versionId"), res.getVersionIdElement());
606    if (json.has("lastUpdated"))
607      res.setLastUpdatedElement(parseInstant(json.get("lastUpdated").getAsString()));
608    if (json.has("_lastUpdated"))
609      parseElementProperties(getJObject(json, "_lastUpdated"), res.getLastUpdatedElement());
610    if (json.has("profile")) {
611      JsonArray array = json.getAsJsonArray("profile");
612      for (int i = 0; i < array.size(); i++) {
613        if (array.get(i).isJsonNull()) {
614          res.getProfile().add(new UriType());
615        } else {
616          res.getProfile().add(parseUri(array.get(i).getAsString()));
617        }
618      }
619    };
620    if (json.has("_profile")) {
621      JsonArray array = json.getAsJsonArray("_profile");
622      for (int i = 0; i < array.size(); i++) {
623        if (i == res.getProfile().size())
624          res.getProfile().add(parseUri(null));
625        if (array.get(i) instanceof JsonObject) 
626          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
627      }
628    };
629    if (json.has("security")) {
630      JsonArray array = json.getAsJsonArray("security");
631      for (int i = 0; i < array.size(); i++) {
632        res.getSecurity().add(parseCoding(array.get(i).getAsJsonObject()));
633      }
634    };
635    if (json.has("tag")) {
636      JsonArray array = json.getAsJsonArray("tag");
637      for (int i = 0; i < array.size(); i++) {
638        res.getTag().add(parseCoding(array.get(i).getAsJsonObject()));
639      }
640    };
641  }
642
643  protected Address parseAddress(JsonObject json) throws IOException, FHIRFormatError {
644    Address res = new Address();
645    parseAddressProperties(json, res);
646    return res;
647  }
648
649  protected void parseAddressProperties(JsonObject json, Address res) throws IOException, FHIRFormatError {
650    parseTypeProperties(json, res);
651    if (json.has("use"))
652      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Address.AddressUse.NULL, new Address.AddressUseEnumFactory()));
653    if (json.has("_use"))
654      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
655    if (json.has("type"))
656      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Address.AddressType.NULL, new Address.AddressTypeEnumFactory()));
657    if (json.has("_type"))
658      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
659    if (json.has("text"))
660      res.setTextElement(parseString(json.get("text").getAsString()));
661    if (json.has("_text"))
662      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
663    if (json.has("line")) {
664      JsonArray array = json.getAsJsonArray("line");
665      for (int i = 0; i < array.size(); i++) {
666        if (array.get(i).isJsonNull()) {
667          res.getLine().add(new StringType());
668        } else {
669          res.getLine().add(parseString(array.get(i).getAsString()));
670        }
671      }
672    };
673    if (json.has("_line")) {
674      JsonArray array = json.getAsJsonArray("_line");
675      for (int i = 0; i < array.size(); i++) {
676        if (i == res.getLine().size())
677          res.getLine().add(parseString(null));
678        if (array.get(i) instanceof JsonObject) 
679          parseElementProperties(array.get(i).getAsJsonObject(), res.getLine().get(i));
680      }
681    };
682    if (json.has("city"))
683      res.setCityElement(parseString(json.get("city").getAsString()));
684    if (json.has("_city"))
685      parseElementProperties(getJObject(json, "_city"), res.getCityElement());
686    if (json.has("district"))
687      res.setDistrictElement(parseString(json.get("district").getAsString()));
688    if (json.has("_district"))
689      parseElementProperties(getJObject(json, "_district"), res.getDistrictElement());
690    if (json.has("state"))
691      res.setStateElement(parseString(json.get("state").getAsString()));
692    if (json.has("_state"))
693      parseElementProperties(getJObject(json, "_state"), res.getStateElement());
694    if (json.has("postalCode"))
695      res.setPostalCodeElement(parseString(json.get("postalCode").getAsString()));
696    if (json.has("_postalCode"))
697      parseElementProperties(getJObject(json, "_postalCode"), res.getPostalCodeElement());
698    if (json.has("country"))
699      res.setCountryElement(parseString(json.get("country").getAsString()));
700    if (json.has("_country"))
701      parseElementProperties(getJObject(json, "_country"), res.getCountryElement());
702    if (json.has("period"))
703      res.setPeriod(parsePeriod(getJObject(json, "period")));
704  }
705
706  protected TriggerDefinition parseTriggerDefinition(JsonObject json) throws IOException, FHIRFormatError {
707    TriggerDefinition res = new TriggerDefinition();
708    parseTriggerDefinitionProperties(json, res);
709    return res;
710  }
711
712  protected void parseTriggerDefinitionProperties(JsonObject json, TriggerDefinition res) throws IOException, FHIRFormatError {
713    parseTypeProperties(json, res);
714    if (json.has("type"))
715      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), TriggerDefinition.TriggerType.NULL, new TriggerDefinition.TriggerTypeEnumFactory()));
716    if (json.has("_type"))
717      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
718    if (json.has("eventName"))
719      res.setEventNameElement(parseString(json.get("eventName").getAsString()));
720    if (json.has("_eventName"))
721      parseElementProperties(getJObject(json, "_eventName"), res.getEventNameElement());
722    Type eventTiming = parseType("eventTiming", json);
723    if (eventTiming != null)
724      res.setEventTiming(eventTiming);
725    if (json.has("eventData"))
726      res.setEventData(parseDataRequirement(getJObject(json, "eventData")));
727  }
728
729  protected Contributor parseContributor(JsonObject json) throws IOException, FHIRFormatError {
730    Contributor res = new Contributor();
731    parseContributorProperties(json, res);
732    return res;
733  }
734
735  protected void parseContributorProperties(JsonObject json, Contributor res) throws IOException, FHIRFormatError {
736    parseTypeProperties(json, res);
737    if (json.has("type"))
738      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Contributor.ContributorType.NULL, new Contributor.ContributorTypeEnumFactory()));
739    if (json.has("_type"))
740      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
741    if (json.has("name"))
742      res.setNameElement(parseString(json.get("name").getAsString()));
743    if (json.has("_name"))
744      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
745    if (json.has("contact")) {
746      JsonArray array = json.getAsJsonArray("contact");
747      for (int i = 0; i < array.size(); i++) {
748        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
749      }
750    };
751  }
752
753  protected DataRequirement parseDataRequirement(JsonObject json) throws IOException, FHIRFormatError {
754    DataRequirement res = new DataRequirement();
755    parseDataRequirementProperties(json, res);
756    return res;
757  }
758
759  protected void parseDataRequirementProperties(JsonObject json, DataRequirement res) throws IOException, FHIRFormatError {
760    parseTypeProperties(json, res);
761    if (json.has("type"))
762      res.setTypeElement(parseCode(json.get("type").getAsString()));
763    if (json.has("_type"))
764      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
765    if (json.has("profile")) {
766      JsonArray array = json.getAsJsonArray("profile");
767      for (int i = 0; i < array.size(); i++) {
768        if (array.get(i).isJsonNull()) {
769          res.getProfile().add(new UriType());
770        } else {
771          res.getProfile().add(parseUri(array.get(i).getAsString()));
772        }
773      }
774    };
775    if (json.has("_profile")) {
776      JsonArray array = json.getAsJsonArray("_profile");
777      for (int i = 0; i < array.size(); i++) {
778        if (i == res.getProfile().size())
779          res.getProfile().add(parseUri(null));
780        if (array.get(i) instanceof JsonObject) 
781          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
782      }
783    };
784    if (json.has("mustSupport")) {
785      JsonArray array = json.getAsJsonArray("mustSupport");
786      for (int i = 0; i < array.size(); i++) {
787        if (array.get(i).isJsonNull()) {
788          res.getMustSupport().add(new StringType());
789        } else {
790          res.getMustSupport().add(parseString(array.get(i).getAsString()));
791        }
792      }
793    };
794    if (json.has("_mustSupport")) {
795      JsonArray array = json.getAsJsonArray("_mustSupport");
796      for (int i = 0; i < array.size(); i++) {
797        if (i == res.getMustSupport().size())
798          res.getMustSupport().add(parseString(null));
799        if (array.get(i) instanceof JsonObject) 
800          parseElementProperties(array.get(i).getAsJsonObject(), res.getMustSupport().get(i));
801      }
802    };
803    if (json.has("codeFilter")) {
804      JsonArray array = json.getAsJsonArray("codeFilter");
805      for (int i = 0; i < array.size(); i++) {
806        res.getCodeFilter().add(parseDataRequirementDataRequirementCodeFilterComponent(array.get(i).getAsJsonObject(), res));
807      }
808    };
809    if (json.has("dateFilter")) {
810      JsonArray array = json.getAsJsonArray("dateFilter");
811      for (int i = 0; i < array.size(); i++) {
812        res.getDateFilter().add(parseDataRequirementDataRequirementDateFilterComponent(array.get(i).getAsJsonObject(), res));
813      }
814    };
815  }
816
817  protected DataRequirement.DataRequirementCodeFilterComponent parseDataRequirementDataRequirementCodeFilterComponent(JsonObject json, DataRequirement owner) throws IOException, FHIRFormatError {
818    DataRequirement.DataRequirementCodeFilterComponent res = new DataRequirement.DataRequirementCodeFilterComponent();
819    parseDataRequirementDataRequirementCodeFilterComponentProperties(json, owner, res);
820    return res;
821  }
822
823  protected void parseDataRequirementDataRequirementCodeFilterComponentProperties(JsonObject json, DataRequirement owner, DataRequirement.DataRequirementCodeFilterComponent res) throws IOException, FHIRFormatError {
824    parseTypeProperties(json, res);
825    if (json.has("path"))
826      res.setPathElement(parseString(json.get("path").getAsString()));
827    if (json.has("_path"))
828      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
829    Type valueSet = parseType("valueSet", json);
830    if (valueSet != null)
831      res.setValueSet(valueSet);
832    if (json.has("valueCode")) {
833      JsonArray array = json.getAsJsonArray("valueCode");
834      for (int i = 0; i < array.size(); i++) {
835        if (array.get(i).isJsonNull()) {
836          res.getValueCode().add(new CodeType());
837        } else {
838          res.getValueCode().add(parseCode(array.get(i).getAsString()));
839        }
840      }
841    };
842    if (json.has("_valueCode")) {
843      JsonArray array = json.getAsJsonArray("_valueCode");
844      for (int i = 0; i < array.size(); i++) {
845        if (i == res.getValueCode().size())
846          res.getValueCode().add(parseCode(null));
847        if (array.get(i) instanceof JsonObject) 
848          parseElementProperties(array.get(i).getAsJsonObject(), res.getValueCode().get(i));
849      }
850    };
851    if (json.has("valueCoding")) {
852      JsonArray array = json.getAsJsonArray("valueCoding");
853      for (int i = 0; i < array.size(); i++) {
854        res.getValueCoding().add(parseCoding(array.get(i).getAsJsonObject()));
855      }
856    };
857    if (json.has("valueCodeableConcept")) {
858      JsonArray array = json.getAsJsonArray("valueCodeableConcept");
859      for (int i = 0; i < array.size(); i++) {
860        res.getValueCodeableConcept().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
861      }
862    };
863  }
864
865  protected DataRequirement.DataRequirementDateFilterComponent parseDataRequirementDataRequirementDateFilterComponent(JsonObject json, DataRequirement owner) throws IOException, FHIRFormatError {
866    DataRequirement.DataRequirementDateFilterComponent res = new DataRequirement.DataRequirementDateFilterComponent();
867    parseDataRequirementDataRequirementDateFilterComponentProperties(json, owner, res);
868    return res;
869  }
870
871  protected void parseDataRequirementDataRequirementDateFilterComponentProperties(JsonObject json, DataRequirement owner, DataRequirement.DataRequirementDateFilterComponent res) throws IOException, FHIRFormatError {
872    parseTypeProperties(json, res);
873    if (json.has("path"))
874      res.setPathElement(parseString(json.get("path").getAsString()));
875    if (json.has("_path"))
876      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
877    Type value = parseType("value", json);
878    if (value != null)
879      res.setValue(value);
880  }
881
882  protected Dosage parseDosage(JsonObject json) throws IOException, FHIRFormatError {
883    Dosage res = new Dosage();
884    parseDosageProperties(json, res);
885    return res;
886  }
887
888  protected void parseDosageProperties(JsonObject json, Dosage res) throws IOException, FHIRFormatError {
889    parseTypeProperties(json, res);
890    if (json.has("sequence"))
891      res.setSequenceElement(parseInteger(json.get("sequence").getAsLong()));
892    if (json.has("_sequence"))
893      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
894    if (json.has("text"))
895      res.setTextElement(parseString(json.get("text").getAsString()));
896    if (json.has("_text"))
897      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
898    if (json.has("additionalInstruction")) {
899      JsonArray array = json.getAsJsonArray("additionalInstruction");
900      for (int i = 0; i < array.size(); i++) {
901        res.getAdditionalInstruction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
902      }
903    };
904    if (json.has("patientInstruction"))
905      res.setPatientInstructionElement(parseString(json.get("patientInstruction").getAsString()));
906    if (json.has("_patientInstruction"))
907      parseElementProperties(getJObject(json, "_patientInstruction"), res.getPatientInstructionElement());
908    if (json.has("timing"))
909      res.setTiming(parseTiming(getJObject(json, "timing")));
910    Type asNeeded = parseType("asNeeded", json);
911    if (asNeeded != null)
912      res.setAsNeeded(asNeeded);
913    if (json.has("site"))
914      res.setSite(parseCodeableConcept(getJObject(json, "site")));
915    if (json.has("route"))
916      res.setRoute(parseCodeableConcept(getJObject(json, "route")));
917    if (json.has("method"))
918      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
919    Type dose = parseType("dose", json);
920    if (dose != null)
921      res.setDose(dose);
922    if (json.has("maxDosePerPeriod"))
923      res.setMaxDosePerPeriod(parseRatio(getJObject(json, "maxDosePerPeriod")));
924    if (json.has("maxDosePerAdministration"))
925      res.setMaxDosePerAdministration(parseSimpleQuantity(getJObject(json, "maxDosePerAdministration")));
926    if (json.has("maxDosePerLifetime"))
927      res.setMaxDosePerLifetime(parseSimpleQuantity(getJObject(json, "maxDosePerLifetime")));
928    Type rate = parseType("rate", json);
929    if (rate != null)
930      res.setRate(rate);
931  }
932
933  protected RelatedArtifact parseRelatedArtifact(JsonObject json) throws IOException, FHIRFormatError {
934    RelatedArtifact res = new RelatedArtifact();
935    parseRelatedArtifactProperties(json, res);
936    return res;
937  }
938
939  protected void parseRelatedArtifactProperties(JsonObject json, RelatedArtifact res) throws IOException, FHIRFormatError {
940    parseTypeProperties(json, res);
941    if (json.has("type"))
942      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), RelatedArtifact.RelatedArtifactType.NULL, new RelatedArtifact.RelatedArtifactTypeEnumFactory()));
943    if (json.has("_type"))
944      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
945    if (json.has("display"))
946      res.setDisplayElement(parseString(json.get("display").getAsString()));
947    if (json.has("_display"))
948      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
949    if (json.has("citation"))
950      res.setCitationElement(parseString(json.get("citation").getAsString()));
951    if (json.has("_citation"))
952      parseElementProperties(getJObject(json, "_citation"), res.getCitationElement());
953    if (json.has("url"))
954      res.setUrlElement(parseUri(json.get("url").getAsString()));
955    if (json.has("_url"))
956      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
957    if (json.has("document"))
958      res.setDocument(parseAttachment(getJObject(json, "document")));
959    if (json.has("resource"))
960      res.setResource(parseReference(getJObject(json, "resource")));
961  }
962
963  protected ContactDetail parseContactDetail(JsonObject json) throws IOException, FHIRFormatError {
964    ContactDetail res = new ContactDetail();
965    parseContactDetailProperties(json, res);
966    return res;
967  }
968
969  protected void parseContactDetailProperties(JsonObject json, ContactDetail res) throws IOException, FHIRFormatError {
970    parseTypeProperties(json, res);
971    if (json.has("name"))
972      res.setNameElement(parseString(json.get("name").getAsString()));
973    if (json.has("_name"))
974      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
975    if (json.has("telecom")) {
976      JsonArray array = json.getAsJsonArray("telecom");
977      for (int i = 0; i < array.size(); i++) {
978        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
979      }
980    };
981  }
982
983  protected HumanName parseHumanName(JsonObject json) throws IOException, FHIRFormatError {
984    HumanName res = new HumanName();
985    parseHumanNameProperties(json, res);
986    return res;
987  }
988
989  protected void parseHumanNameProperties(JsonObject json, HumanName res) throws IOException, FHIRFormatError {
990    parseTypeProperties(json, res);
991    if (json.has("use"))
992      res.setUseElement(parseEnumeration(json.get("use").getAsString(), HumanName.NameUse.NULL, new HumanName.NameUseEnumFactory()));
993    if (json.has("_use"))
994      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
995    if (json.has("text"))
996      res.setTextElement(parseString(json.get("text").getAsString()));
997    if (json.has("_text"))
998      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
999    if (json.has("family"))
1000      res.setFamilyElement(parseString(json.get("family").getAsString()));
1001    if (json.has("_family"))
1002      parseElementProperties(getJObject(json, "_family"), res.getFamilyElement());
1003    if (json.has("given")) {
1004      JsonArray array = json.getAsJsonArray("given");
1005      for (int i = 0; i < array.size(); i++) {
1006        if (array.get(i).isJsonNull()) {
1007          res.getGiven().add(new StringType());
1008        } else {
1009          res.getGiven().add(parseString(array.get(i).getAsString()));
1010        }
1011      }
1012    };
1013    if (json.has("_given")) {
1014      JsonArray array = json.getAsJsonArray("_given");
1015      for (int i = 0; i < array.size(); i++) {
1016        if (i == res.getGiven().size())
1017          res.getGiven().add(parseString(null));
1018        if (array.get(i) instanceof JsonObject) 
1019          parseElementProperties(array.get(i).getAsJsonObject(), res.getGiven().get(i));
1020      }
1021    };
1022    if (json.has("prefix")) {
1023      JsonArray array = json.getAsJsonArray("prefix");
1024      for (int i = 0; i < array.size(); i++) {
1025        if (array.get(i).isJsonNull()) {
1026          res.getPrefix().add(new StringType());
1027        } else {
1028          res.getPrefix().add(parseString(array.get(i).getAsString()));
1029        }
1030      }
1031    };
1032    if (json.has("_prefix")) {
1033      JsonArray array = json.getAsJsonArray("_prefix");
1034      for (int i = 0; i < array.size(); i++) {
1035        if (i == res.getPrefix().size())
1036          res.getPrefix().add(parseString(null));
1037        if (array.get(i) instanceof JsonObject) 
1038          parseElementProperties(array.get(i).getAsJsonObject(), res.getPrefix().get(i));
1039      }
1040    };
1041    if (json.has("suffix")) {
1042      JsonArray array = json.getAsJsonArray("suffix");
1043      for (int i = 0; i < array.size(); i++) {
1044        if (array.get(i).isJsonNull()) {
1045          res.getSuffix().add(new StringType());
1046        } else {
1047          res.getSuffix().add(parseString(array.get(i).getAsString()));
1048        }
1049      }
1050    };
1051    if (json.has("_suffix")) {
1052      JsonArray array = json.getAsJsonArray("_suffix");
1053      for (int i = 0; i < array.size(); i++) {
1054        if (i == res.getSuffix().size())
1055          res.getSuffix().add(parseString(null));
1056        if (array.get(i) instanceof JsonObject) 
1057          parseElementProperties(array.get(i).getAsJsonObject(), res.getSuffix().get(i));
1058      }
1059    };
1060    if (json.has("period"))
1061      res.setPeriod(parsePeriod(getJObject(json, "period")));
1062  }
1063
1064  protected ContactPoint parseContactPoint(JsonObject json) throws IOException, FHIRFormatError {
1065    ContactPoint res = new ContactPoint();
1066    parseContactPointProperties(json, res);
1067    return res;
1068  }
1069
1070  protected void parseContactPointProperties(JsonObject json, ContactPoint res) throws IOException, FHIRFormatError {
1071    parseTypeProperties(json, res);
1072    if (json.has("system"))
1073      res.setSystemElement(parseEnumeration(json.get("system").getAsString(), ContactPoint.ContactPointSystem.NULL, new ContactPoint.ContactPointSystemEnumFactory()));
1074    if (json.has("_system"))
1075      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
1076    if (json.has("value"))
1077      res.setValueElement(parseString(json.get("value").getAsString()));
1078    if (json.has("_value"))
1079      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
1080    if (json.has("use"))
1081      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ContactPoint.ContactPointUse.NULL, new ContactPoint.ContactPointUseEnumFactory()));
1082    if (json.has("_use"))
1083      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
1084    if (json.has("rank"))
1085      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
1086    if (json.has("_rank"))
1087      parseElementProperties(getJObject(json, "_rank"), res.getRankElement());
1088    if (json.has("period"))
1089      res.setPeriod(parsePeriod(getJObject(json, "period")));
1090  }
1091
1092  protected UsageContext parseUsageContext(JsonObject json) throws IOException, FHIRFormatError {
1093    UsageContext res = new UsageContext();
1094    parseUsageContextProperties(json, res);
1095    return res;
1096  }
1097
1098  protected void parseUsageContextProperties(JsonObject json, UsageContext res) throws IOException, FHIRFormatError {
1099    parseTypeProperties(json, res);
1100    if (json.has("code"))
1101      res.setCode(parseCoding(getJObject(json, "code")));
1102    Type value = parseType("value", json);
1103    if (value != null)
1104      res.setValue(value);
1105  }
1106
1107  protected Timing parseTiming(JsonObject json) throws IOException, FHIRFormatError {
1108    Timing res = new Timing();
1109    parseTimingProperties(json, res);
1110    return res;
1111  }
1112
1113  protected void parseTimingProperties(JsonObject json, Timing res) throws IOException, FHIRFormatError {
1114    parseTypeProperties(json, res);
1115    if (json.has("event")) {
1116      JsonArray array = json.getAsJsonArray("event");
1117      for (int i = 0; i < array.size(); i++) {
1118        if (array.get(i).isJsonNull()) {
1119          res.getEvent().add(new DateTimeType());
1120        } else {
1121          res.getEvent().add(parseDateTime(array.get(i).getAsString()));
1122        }
1123      }
1124    };
1125    if (json.has("_event")) {
1126      JsonArray array = json.getAsJsonArray("_event");
1127      for (int i = 0; i < array.size(); i++) {
1128        if (i == res.getEvent().size())
1129          res.getEvent().add(parseDateTime(null));
1130        if (array.get(i) instanceof JsonObject) 
1131          parseElementProperties(array.get(i).getAsJsonObject(), res.getEvent().get(i));
1132      }
1133    };
1134    if (json.has("repeat"))
1135      res.setRepeat(parseTimingTimingRepeatComponent(getJObject(json, "repeat"), res));
1136    if (json.has("code"))
1137      res.setCode(parseCodeableConcept(getJObject(json, "code")));
1138  }
1139
1140  protected Timing.TimingRepeatComponent parseTimingTimingRepeatComponent(JsonObject json, Timing owner) throws IOException, FHIRFormatError {
1141    Timing.TimingRepeatComponent res = new Timing.TimingRepeatComponent();
1142    parseTimingTimingRepeatComponentProperties(json, owner, res);
1143    return res;
1144  }
1145
1146  protected void parseTimingTimingRepeatComponentProperties(JsonObject json, Timing owner, Timing.TimingRepeatComponent res) throws IOException, FHIRFormatError {
1147    parseTypeProperties(json, res);
1148    Type bounds = parseType("bounds", json);
1149    if (bounds != null)
1150      res.setBounds(bounds);
1151    if (json.has("count"))
1152      res.setCountElement(parseInteger(json.get("count").getAsLong()));
1153    if (json.has("_count"))
1154      parseElementProperties(getJObject(json, "_count"), res.getCountElement());
1155    if (json.has("countMax"))
1156      res.setCountMaxElement(parseInteger(json.get("countMax").getAsLong()));
1157    if (json.has("_countMax"))
1158      parseElementProperties(getJObject(json, "_countMax"), res.getCountMaxElement());
1159    if (json.has("duration"))
1160      res.setDurationElement(parseDecimal(json.get("duration").getAsBigDecimal()));
1161    if (json.has("_duration"))
1162      parseElementProperties(getJObject(json, "_duration"), res.getDurationElement());
1163    if (json.has("durationMax"))
1164      res.setDurationMaxElement(parseDecimal(json.get("durationMax").getAsBigDecimal()));
1165    if (json.has("_durationMax"))
1166      parseElementProperties(getJObject(json, "_durationMax"), res.getDurationMaxElement());
1167    if (json.has("durationUnit"))
1168      res.setDurationUnitElement(parseEnumeration(json.get("durationUnit").getAsString(), Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
1169    if (json.has("_durationUnit"))
1170      parseElementProperties(getJObject(json, "_durationUnit"), res.getDurationUnitElement());
1171    if (json.has("frequency"))
1172      res.setFrequencyElement(parseInteger(json.get("frequency").getAsLong()));
1173    if (json.has("_frequency"))
1174      parseElementProperties(getJObject(json, "_frequency"), res.getFrequencyElement());
1175    if (json.has("frequencyMax"))
1176      res.setFrequencyMaxElement(parseInteger(json.get("frequencyMax").getAsLong()));
1177    if (json.has("_frequencyMax"))
1178      parseElementProperties(getJObject(json, "_frequencyMax"), res.getFrequencyMaxElement());
1179    if (json.has("period"))
1180      res.setPeriodElement(parseDecimal(json.get("period").getAsBigDecimal()));
1181    if (json.has("_period"))
1182      parseElementProperties(getJObject(json, "_period"), res.getPeriodElement());
1183    if (json.has("periodMax"))
1184      res.setPeriodMaxElement(parseDecimal(json.get("periodMax").getAsBigDecimal()));
1185    if (json.has("_periodMax"))
1186      parseElementProperties(getJObject(json, "_periodMax"), res.getPeriodMaxElement());
1187    if (json.has("periodUnit"))
1188      res.setPeriodUnitElement(parseEnumeration(json.get("periodUnit").getAsString(), Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
1189    if (json.has("_periodUnit"))
1190      parseElementProperties(getJObject(json, "_periodUnit"), res.getPeriodUnitElement());
1191    if (json.has("dayOfWeek")) {
1192      JsonArray array = json.getAsJsonArray("dayOfWeek");
1193      for (int i = 0; i < array.size(); i++) {
1194        if (array.get(i).isJsonNull()) {
1195          res.getDayOfWeek().add(new Enumeration<Timing.DayOfWeek>());
1196        } else {
1197          res.getDayOfWeek().add(parseEnumeration(array.get(i).getAsString(), Timing.DayOfWeek.NULL, new Timing.DayOfWeekEnumFactory()));
1198        }
1199      }
1200    };
1201    if (json.has("_dayOfWeek")) {
1202      JsonArray array = json.getAsJsonArray("_dayOfWeek");
1203      for (int i = 0; i < array.size(); i++) {
1204        if (i == res.getDayOfWeek().size())
1205          res.getDayOfWeek().add(parseEnumeration(null, Timing.DayOfWeek.NULL, new Timing.DayOfWeekEnumFactory()));
1206        if (array.get(i) instanceof JsonObject) 
1207          parseElementProperties(array.get(i).getAsJsonObject(), res.getDayOfWeek().get(i));
1208      }
1209    };
1210    if (json.has("timeOfDay")) {
1211      JsonArray array = json.getAsJsonArray("timeOfDay");
1212      for (int i = 0; i < array.size(); i++) {
1213        if (array.get(i).isJsonNull()) {
1214          res.getTimeOfDay().add(new TimeType());
1215        } else {
1216          res.getTimeOfDay().add(parseTime(array.get(i).getAsString()));
1217        }
1218      }
1219    };
1220    if (json.has("_timeOfDay")) {
1221      JsonArray array = json.getAsJsonArray("_timeOfDay");
1222      for (int i = 0; i < array.size(); i++) {
1223        if (i == res.getTimeOfDay().size())
1224          res.getTimeOfDay().add(parseTime(null));
1225        if (array.get(i) instanceof JsonObject) 
1226          parseElementProperties(array.get(i).getAsJsonObject(), res.getTimeOfDay().get(i));
1227      }
1228    };
1229    if (json.has("when")) {
1230      JsonArray array = json.getAsJsonArray("when");
1231      for (int i = 0; i < array.size(); i++) {
1232        if (array.get(i).isJsonNull()) {
1233          res.getWhen().add(new Enumeration<Timing.EventTiming>());
1234        } else {
1235          res.getWhen().add(parseEnumeration(array.get(i).getAsString(), Timing.EventTiming.NULL, new Timing.EventTimingEnumFactory()));
1236        }
1237      }
1238    };
1239    if (json.has("_when")) {
1240      JsonArray array = json.getAsJsonArray("_when");
1241      for (int i = 0; i < array.size(); i++) {
1242        if (i == res.getWhen().size())
1243          res.getWhen().add(parseEnumeration(null, Timing.EventTiming.NULL, new Timing.EventTimingEnumFactory()));
1244        if (array.get(i) instanceof JsonObject) 
1245          parseElementProperties(array.get(i).getAsJsonObject(), res.getWhen().get(i));
1246      }
1247    };
1248    if (json.has("offset"))
1249      res.setOffsetElement(parseUnsignedInt(json.get("offset").getAsString()));
1250    if (json.has("_offset"))
1251      parseElementProperties(getJObject(json, "_offset"), res.getOffsetElement());
1252  }
1253
1254  protected ElementDefinition parseElementDefinition(JsonObject json) throws IOException, FHIRFormatError {
1255    ElementDefinition res = new ElementDefinition();
1256    parseElementDefinitionProperties(json, res);
1257    return res;
1258  }
1259
1260  protected void parseElementDefinitionProperties(JsonObject json, ElementDefinition res) throws IOException, FHIRFormatError {
1261    parseTypeProperties(json, res);
1262    if (json.has("path"))
1263      res.setPathElement(parseString(json.get("path").getAsString()));
1264    if (json.has("_path"))
1265      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
1266    if (json.has("representation")) {
1267      JsonArray array = json.getAsJsonArray("representation");
1268      for (int i = 0; i < array.size(); i++) {
1269        if (array.get(i).isJsonNull()) {
1270          res.getRepresentation().add(new Enumeration<ElementDefinition.PropertyRepresentation>());
1271        } else {
1272          res.getRepresentation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
1273        }
1274      }
1275    };
1276    if (json.has("_representation")) {
1277      JsonArray array = json.getAsJsonArray("_representation");
1278      for (int i = 0; i < array.size(); i++) {
1279        if (i == res.getRepresentation().size())
1280          res.getRepresentation().add(parseEnumeration(null, ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
1281        if (array.get(i) instanceof JsonObject) 
1282          parseElementProperties(array.get(i).getAsJsonObject(), res.getRepresentation().get(i));
1283      }
1284    };
1285    if (json.has("sliceName"))
1286      res.setSliceNameElement(parseString(json.get("sliceName").getAsString()));
1287    if (json.has("_sliceName"))
1288      parseElementProperties(getJObject(json, "_sliceName"), res.getSliceNameElement());
1289    if (json.has("label"))
1290      res.setLabelElement(parseString(json.get("label").getAsString()));
1291    if (json.has("_label"))
1292      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
1293    if (json.has("code")) {
1294      JsonArray array = json.getAsJsonArray("code");
1295      for (int i = 0; i < array.size(); i++) {
1296        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
1297      }
1298    };
1299    if (json.has("slicing"))
1300      res.setSlicing(parseElementDefinitionElementDefinitionSlicingComponent(getJObject(json, "slicing"), res));
1301    if (json.has("short"))
1302      res.setShortElement(parseString(json.get("short").getAsString()));
1303    if (json.has("_short"))
1304      parseElementProperties(getJObject(json, "_short"), res.getShortElement());
1305    if (json.has("definition"))
1306      res.setDefinitionElement(parseMarkdown(json.get("definition").getAsString()));
1307    if (json.has("_definition"))
1308      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
1309    if (json.has("comment"))
1310      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
1311    if (json.has("_comment"))
1312      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
1313    if (json.has("requirements"))
1314      res.setRequirementsElement(parseMarkdown(json.get("requirements").getAsString()));
1315    if (json.has("_requirements"))
1316      parseElementProperties(getJObject(json, "_requirements"), res.getRequirementsElement());
1317    if (json.has("alias")) {
1318      JsonArray array = json.getAsJsonArray("alias");
1319      for (int i = 0; i < array.size(); i++) {
1320        if (array.get(i).isJsonNull()) {
1321          res.getAlias().add(new StringType());
1322        } else {
1323          res.getAlias().add(parseString(array.get(i).getAsString()));
1324        }
1325      }
1326    };
1327    if (json.has("_alias")) {
1328      JsonArray array = json.getAsJsonArray("_alias");
1329      for (int i = 0; i < array.size(); i++) {
1330        if (i == res.getAlias().size())
1331          res.getAlias().add(parseString(null));
1332        if (array.get(i) instanceof JsonObject) 
1333          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
1334      }
1335    };
1336    if (json.has("min"))
1337      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
1338    if (json.has("_min"))
1339      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
1340    if (json.has("max"))
1341      res.setMaxElement(parseString(json.get("max").getAsString()));
1342    if (json.has("_max"))
1343      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
1344    if (json.has("base"))
1345      res.setBase(parseElementDefinitionElementDefinitionBaseComponent(getJObject(json, "base"), res));
1346    if (json.has("contentReference"))
1347      res.setContentReferenceElement(parseUri(json.get("contentReference").getAsString()));
1348    if (json.has("_contentReference"))
1349      parseElementProperties(getJObject(json, "_contentReference"), res.getContentReferenceElement());
1350    if (json.has("type")) {
1351      JsonArray array = json.getAsJsonArray("type");
1352      for (int i = 0; i < array.size(); i++) {
1353        res.getType().add(parseElementDefinitionTypeRefComponent(array.get(i).getAsJsonObject(), res));
1354      }
1355    };
1356    Type defaultValue = parseType("defaultValue", json);
1357    if (defaultValue != null)
1358      res.setDefaultValue(defaultValue);
1359    if (json.has("meaningWhenMissing"))
1360      res.setMeaningWhenMissingElement(parseMarkdown(json.get("meaningWhenMissing").getAsString()));
1361    if (json.has("_meaningWhenMissing"))
1362      parseElementProperties(getJObject(json, "_meaningWhenMissing"), res.getMeaningWhenMissingElement());
1363    if (json.has("orderMeaning"))
1364      res.setOrderMeaningElement(parseString(json.get("orderMeaning").getAsString()));
1365    if (json.has("_orderMeaning"))
1366      parseElementProperties(getJObject(json, "_orderMeaning"), res.getOrderMeaningElement());
1367    Type fixed = parseType("fixed", json);
1368    if (fixed != null)
1369      res.setFixed(fixed);
1370    Type pattern = parseType("pattern", json);
1371    if (pattern != null)
1372      res.setPattern(pattern);
1373    if (json.has("example")) {
1374      JsonArray array = json.getAsJsonArray("example");
1375      for (int i = 0; i < array.size(); i++) {
1376        res.getExample().add(parseElementDefinitionElementDefinitionExampleComponent(array.get(i).getAsJsonObject(), res));
1377      }
1378    };
1379    Type minValue = parseType("minValue", json);
1380    if (minValue != null)
1381      res.setMinValue(minValue);
1382    Type maxValue = parseType("maxValue", json);
1383    if (maxValue != null)
1384      res.setMaxValue(maxValue);
1385    if (json.has("maxLength"))
1386      res.setMaxLengthElement(parseInteger(json.get("maxLength").getAsLong()));
1387    if (json.has("_maxLength"))
1388      parseElementProperties(getJObject(json, "_maxLength"), res.getMaxLengthElement());
1389    if (json.has("condition")) {
1390      JsonArray array = json.getAsJsonArray("condition");
1391      for (int i = 0; i < array.size(); i++) {
1392        if (array.get(i).isJsonNull()) {
1393          res.getCondition().add(new IdType());
1394        } else {
1395          res.getCondition().add(parseId(array.get(i).getAsString()));
1396        }
1397      }
1398    };
1399    if (json.has("_condition")) {
1400      JsonArray array = json.getAsJsonArray("_condition");
1401      for (int i = 0; i < array.size(); i++) {
1402        if (i == res.getCondition().size())
1403          res.getCondition().add(parseId(null));
1404        if (array.get(i) instanceof JsonObject) 
1405          parseElementProperties(array.get(i).getAsJsonObject(), res.getCondition().get(i));
1406      }
1407    };
1408    if (json.has("constraint")) {
1409      JsonArray array = json.getAsJsonArray("constraint");
1410      for (int i = 0; i < array.size(); i++) {
1411        res.getConstraint().add(parseElementDefinitionElementDefinitionConstraintComponent(array.get(i).getAsJsonObject(), res));
1412      }
1413    };
1414    if (json.has("mustSupport"))
1415      res.setMustSupportElement(parseBoolean(json.get("mustSupport").getAsBoolean()));
1416    if (json.has("_mustSupport"))
1417      parseElementProperties(getJObject(json, "_mustSupport"), res.getMustSupportElement());
1418    if (json.has("isModifier"))
1419      res.setIsModifierElement(parseBoolean(json.get("isModifier").getAsBoolean()));
1420    if (json.has("_isModifier"))
1421      parseElementProperties(getJObject(json, "_isModifier"), res.getIsModifierElement());
1422    if (json.has("isSummary"))
1423      res.setIsSummaryElement(parseBoolean(json.get("isSummary").getAsBoolean()));
1424    if (json.has("_isSummary"))
1425      parseElementProperties(getJObject(json, "_isSummary"), res.getIsSummaryElement());
1426    if (json.has("binding"))
1427      res.setBinding(parseElementDefinitionElementDefinitionBindingComponent(getJObject(json, "binding"), res));
1428    if (json.has("mapping")) {
1429      JsonArray array = json.getAsJsonArray("mapping");
1430      for (int i = 0; i < array.size(); i++) {
1431        res.getMapping().add(parseElementDefinitionElementDefinitionMappingComponent(array.get(i).getAsJsonObject(), res));
1432      }
1433    };
1434  }
1435
1436  protected ElementDefinition.ElementDefinitionSlicingComponent parseElementDefinitionElementDefinitionSlicingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1437    ElementDefinition.ElementDefinitionSlicingComponent res = new ElementDefinition.ElementDefinitionSlicingComponent();
1438    parseElementDefinitionElementDefinitionSlicingComponentProperties(json, owner, res);
1439    return res;
1440  }
1441
1442  protected void parseElementDefinitionElementDefinitionSlicingComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionSlicingComponent res) throws IOException, FHIRFormatError {
1443    parseTypeProperties(json, res);
1444    if (json.has("discriminator")) {
1445      JsonArray array = json.getAsJsonArray("discriminator");
1446      for (int i = 0; i < array.size(); i++) {
1447        res.getDiscriminator().add(parseElementDefinitionElementDefinitionSlicingDiscriminatorComponent(array.get(i).getAsJsonObject(), owner));
1448      }
1449    };
1450    if (json.has("description"))
1451      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1452    if (json.has("_description"))
1453      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
1454    if (json.has("ordered"))
1455      res.setOrderedElement(parseBoolean(json.get("ordered").getAsBoolean()));
1456    if (json.has("_ordered"))
1457      parseElementProperties(getJObject(json, "_ordered"), res.getOrderedElement());
1458    if (json.has("rules"))
1459      res.setRulesElement(parseEnumeration(json.get("rules").getAsString(), ElementDefinition.SlicingRules.NULL, new ElementDefinition.SlicingRulesEnumFactory()));
1460    if (json.has("_rules"))
1461      parseElementProperties(getJObject(json, "_rules"), res.getRulesElement());
1462  }
1463
1464  protected ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent parseElementDefinitionElementDefinitionSlicingDiscriminatorComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1465    ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent res = new ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent();
1466    parseElementDefinitionElementDefinitionSlicingDiscriminatorComponentProperties(json, owner, res);
1467    return res;
1468  }
1469
1470  protected void parseElementDefinitionElementDefinitionSlicingDiscriminatorComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent res) throws IOException, FHIRFormatError {
1471    parseTypeProperties(json, res);
1472    if (json.has("type"))
1473      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ElementDefinition.DiscriminatorType.NULL, new ElementDefinition.DiscriminatorTypeEnumFactory()));
1474    if (json.has("_type"))
1475      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
1476    if (json.has("path"))
1477      res.setPathElement(parseString(json.get("path").getAsString()));
1478    if (json.has("_path"))
1479      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
1480  }
1481
1482  protected ElementDefinition.ElementDefinitionBaseComponent parseElementDefinitionElementDefinitionBaseComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1483    ElementDefinition.ElementDefinitionBaseComponent res = new ElementDefinition.ElementDefinitionBaseComponent();
1484    parseElementDefinitionElementDefinitionBaseComponentProperties(json, owner, res);
1485    return res;
1486  }
1487
1488  protected void parseElementDefinitionElementDefinitionBaseComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionBaseComponent res) throws IOException, FHIRFormatError {
1489    parseTypeProperties(json, res);
1490    if (json.has("path"))
1491      res.setPathElement(parseString(json.get("path").getAsString()));
1492    if (json.has("_path"))
1493      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
1494    if (json.has("min"))
1495      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
1496    if (json.has("_min"))
1497      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
1498    if (json.has("max"))
1499      res.setMaxElement(parseString(json.get("max").getAsString()));
1500    if (json.has("_max"))
1501      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
1502  }
1503
1504  protected ElementDefinition.TypeRefComponent parseElementDefinitionTypeRefComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1505    ElementDefinition.TypeRefComponent res = new ElementDefinition.TypeRefComponent();
1506    parseElementDefinitionTypeRefComponentProperties(json, owner, res);
1507    return res;
1508  }
1509
1510  protected void parseElementDefinitionTypeRefComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.TypeRefComponent res) throws IOException, FHIRFormatError {
1511    parseTypeProperties(json, res);
1512    if (json.has("code"))
1513      res.setCodeElement(parseUri(json.get("code").getAsString()));
1514    if (json.has("_code"))
1515      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
1516    if (json.has("profile"))
1517      res.setProfileElement(parseUri(json.get("profile").getAsString()));
1518    if (json.has("_profile"))
1519      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
1520    if (json.has("targetProfile"))
1521      res.setTargetProfileElement(parseUri(json.get("targetProfile").getAsString()));
1522    if (json.has("_targetProfile"))
1523      parseElementProperties(getJObject(json, "_targetProfile"), res.getTargetProfileElement());
1524    if (json.has("aggregation")) {
1525      JsonArray array = json.getAsJsonArray("aggregation");
1526      for (int i = 0; i < array.size(); i++) {
1527        if (array.get(i).isJsonNull()) {
1528          res.getAggregation().add(new Enumeration<ElementDefinition.AggregationMode>());
1529        } else {
1530          res.getAggregation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
1531        }
1532      }
1533    };
1534    if (json.has("_aggregation")) {
1535      JsonArray array = json.getAsJsonArray("_aggregation");
1536      for (int i = 0; i < array.size(); i++) {
1537        if (i == res.getAggregation().size())
1538          res.getAggregation().add(parseEnumeration(null, ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
1539        if (array.get(i) instanceof JsonObject) 
1540          parseElementProperties(array.get(i).getAsJsonObject(), res.getAggregation().get(i));
1541      }
1542    };
1543    if (json.has("versioning"))
1544      res.setVersioningElement(parseEnumeration(json.get("versioning").getAsString(), ElementDefinition.ReferenceVersionRules.NULL, new ElementDefinition.ReferenceVersionRulesEnumFactory()));
1545    if (json.has("_versioning"))
1546      parseElementProperties(getJObject(json, "_versioning"), res.getVersioningElement());
1547  }
1548
1549  protected ElementDefinition.ElementDefinitionExampleComponent parseElementDefinitionElementDefinitionExampleComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1550    ElementDefinition.ElementDefinitionExampleComponent res = new ElementDefinition.ElementDefinitionExampleComponent();
1551    parseElementDefinitionElementDefinitionExampleComponentProperties(json, owner, res);
1552    return res;
1553  }
1554
1555  protected void parseElementDefinitionElementDefinitionExampleComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionExampleComponent res) throws IOException, FHIRFormatError {
1556    parseTypeProperties(json, res);
1557    if (json.has("label"))
1558      res.setLabelElement(parseString(json.get("label").getAsString()));
1559    if (json.has("_label"))
1560      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
1561    Type value = parseType("value", json);
1562    if (value != null)
1563      res.setValue(value);
1564  }
1565
1566  protected ElementDefinition.ElementDefinitionConstraintComponent parseElementDefinitionElementDefinitionConstraintComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1567    ElementDefinition.ElementDefinitionConstraintComponent res = new ElementDefinition.ElementDefinitionConstraintComponent();
1568    parseElementDefinitionElementDefinitionConstraintComponentProperties(json, owner, res);
1569    return res;
1570  }
1571
1572  protected void parseElementDefinitionElementDefinitionConstraintComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionConstraintComponent res) throws IOException, FHIRFormatError {
1573    parseTypeProperties(json, res);
1574    if (json.has("key"))
1575      res.setKeyElement(parseId(json.get("key").getAsString()));
1576    if (json.has("_key"))
1577      parseElementProperties(getJObject(json, "_key"), res.getKeyElement());
1578    if (json.has("requirements"))
1579      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
1580    if (json.has("_requirements"))
1581      parseElementProperties(getJObject(json, "_requirements"), res.getRequirementsElement());
1582    if (json.has("severity"))
1583      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), ElementDefinition.ConstraintSeverity.NULL, new ElementDefinition.ConstraintSeverityEnumFactory()));
1584    if (json.has("_severity"))
1585      parseElementProperties(getJObject(json, "_severity"), res.getSeverityElement());
1586    if (json.has("human"))
1587      res.setHumanElement(parseString(json.get("human").getAsString()));
1588    if (json.has("_human"))
1589      parseElementProperties(getJObject(json, "_human"), res.getHumanElement());
1590    if (json.has("expression"))
1591      res.setExpressionElement(parseString(json.get("expression").getAsString()));
1592    if (json.has("_expression"))
1593      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
1594    if (json.has("xpath"))
1595      res.setXpathElement(parseString(json.get("xpath").getAsString()));
1596    if (json.has("_xpath"))
1597      parseElementProperties(getJObject(json, "_xpath"), res.getXpathElement());
1598    if (json.has("source"))
1599      res.setSourceElement(parseUri(json.get("source").getAsString()));
1600    if (json.has("_source"))
1601      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
1602  }
1603
1604  protected ElementDefinition.ElementDefinitionBindingComponent parseElementDefinitionElementDefinitionBindingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1605    ElementDefinition.ElementDefinitionBindingComponent res = new ElementDefinition.ElementDefinitionBindingComponent();
1606    parseElementDefinitionElementDefinitionBindingComponentProperties(json, owner, res);
1607    return res;
1608  }
1609
1610  protected void parseElementDefinitionElementDefinitionBindingComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionBindingComponent res) throws IOException, FHIRFormatError {
1611    parseTypeProperties(json, res);
1612    if (json.has("strength"))
1613      res.setStrengthElement(parseEnumeration(json.get("strength").getAsString(), Enumerations.BindingStrength.NULL, new Enumerations.BindingStrengthEnumFactory()));
1614    if (json.has("_strength"))
1615      parseElementProperties(getJObject(json, "_strength"), res.getStrengthElement());
1616    if (json.has("description"))
1617      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1618    if (json.has("_description"))
1619      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
1620    Type valueSet = parseType("valueSet", json);
1621    if (valueSet != null)
1622      res.setValueSet(valueSet);
1623  }
1624
1625  protected ElementDefinition.ElementDefinitionMappingComponent parseElementDefinitionElementDefinitionMappingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1626    ElementDefinition.ElementDefinitionMappingComponent res = new ElementDefinition.ElementDefinitionMappingComponent();
1627    parseElementDefinitionElementDefinitionMappingComponentProperties(json, owner, res);
1628    return res;
1629  }
1630
1631  protected void parseElementDefinitionElementDefinitionMappingComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionMappingComponent res) throws IOException, FHIRFormatError {
1632    parseTypeProperties(json, res);
1633    if (json.has("identity"))
1634      res.setIdentityElement(parseId(json.get("identity").getAsString()));
1635    if (json.has("_identity"))
1636      parseElementProperties(getJObject(json, "_identity"), res.getIdentityElement());
1637    if (json.has("language"))
1638      res.setLanguageElement(parseCode(json.get("language").getAsString()));
1639    if (json.has("_language"))
1640      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
1641    if (json.has("map"))
1642      res.setMapElement(parseString(json.get("map").getAsString()));
1643    if (json.has("_map"))
1644      parseElementProperties(getJObject(json, "_map"), res.getMapElement());
1645    if (json.has("comment"))
1646      res.setCommentElement(parseString(json.get("comment").getAsString()));
1647    if (json.has("_comment"))
1648      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
1649  }
1650
1651  protected ParameterDefinition parseParameterDefinition(JsonObject json) throws IOException, FHIRFormatError {
1652    ParameterDefinition res = new ParameterDefinition();
1653    parseParameterDefinitionProperties(json, res);
1654    return res;
1655  }
1656
1657  protected void parseParameterDefinitionProperties(JsonObject json, ParameterDefinition res) throws IOException, FHIRFormatError {
1658    parseTypeProperties(json, res);
1659    if (json.has("name"))
1660      res.setNameElement(parseCode(json.get("name").getAsString()));
1661    if (json.has("_name"))
1662      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
1663    if (json.has("use"))
1664      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ParameterDefinition.ParameterUse.NULL, new ParameterDefinition.ParameterUseEnumFactory()));
1665    if (json.has("_use"))
1666      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
1667    if (json.has("min"))
1668      res.setMinElement(parseInteger(json.get("min").getAsLong()));
1669    if (json.has("_min"))
1670      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
1671    if (json.has("max"))
1672      res.setMaxElement(parseString(json.get("max").getAsString()));
1673    if (json.has("_max"))
1674      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
1675    if (json.has("documentation"))
1676      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
1677    if (json.has("_documentation"))
1678      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
1679    if (json.has("type"))
1680      res.setTypeElement(parseCode(json.get("type").getAsString()));
1681    if (json.has("_type"))
1682      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
1683    if (json.has("profile"))
1684      res.setProfile(parseReference(getJObject(json, "profile")));
1685  }
1686
1687  protected void parseDomainResourceProperties(JsonObject json, DomainResource res) throws IOException, FHIRFormatError {
1688    parseResourceProperties(json, res);
1689    if (json.has("text"))
1690      res.setText(parseNarrative(getJObject(json, "text")));
1691    if (json.has("contained")) {
1692      JsonArray array = json.getAsJsonArray("contained");
1693      for (int i = 0; i < array.size(); i++) {
1694        res.getContained().add(parseResource(array.get(i).getAsJsonObject()));
1695      }
1696    };
1697    if (json.has("extension")) {
1698      JsonArray array = json.getAsJsonArray("extension");
1699      for (int i = 0; i < array.size(); i++) {
1700        res.getExtension().add(parseExtension(array.get(i).getAsJsonObject()));
1701      }
1702    };
1703    if (json.has("modifierExtension")) {
1704      JsonArray array = json.getAsJsonArray("modifierExtension");
1705      for (int i = 0; i < array.size(); i++) {
1706        res.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
1707      }
1708    };
1709  }
1710
1711  protected Parameters parseParameters(JsonObject json) throws IOException, FHIRFormatError {
1712    Parameters res = new Parameters();
1713    parseParametersProperties(json, res);
1714    return res;
1715  }
1716
1717  protected void parseParametersProperties(JsonObject json, Parameters res) throws IOException, FHIRFormatError {
1718    parseResourceProperties(json, res);
1719    if (json.has("parameter")) {
1720      JsonArray array = json.getAsJsonArray("parameter");
1721      for (int i = 0; i < array.size(); i++) {
1722        res.getParameter().add(parseParametersParametersParameterComponent(array.get(i).getAsJsonObject(), res));
1723      }
1724    };
1725  }
1726
1727  protected Parameters.ParametersParameterComponent parseParametersParametersParameterComponent(JsonObject json, Parameters owner) throws IOException, FHIRFormatError {
1728    Parameters.ParametersParameterComponent res = new Parameters.ParametersParameterComponent();
1729    parseParametersParametersParameterComponentProperties(json, owner, res);
1730    return res;
1731  }
1732
1733  protected void parseParametersParametersParameterComponentProperties(JsonObject json, Parameters owner, Parameters.ParametersParameterComponent res) throws IOException, FHIRFormatError {
1734    parseBackboneProperties(json, res);
1735    if (json.has("name"))
1736      res.setNameElement(parseString(json.get("name").getAsString()));
1737    if (json.has("_name"))
1738      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
1739    Type value = parseType("value", json);
1740    if (value != null)
1741      res.setValue(value);
1742    if (json.has("resource"))
1743      res.setResource(parseResource(getJObject(json, "resource")));
1744    if (json.has("part")) {
1745      JsonArray array = json.getAsJsonArray("part");
1746      for (int i = 0; i < array.size(); i++) {
1747        res.getPart().add(parseParametersParametersParameterComponent(array.get(i).getAsJsonObject(), owner));
1748      }
1749    };
1750  }
1751
1752  protected void parseResourceProperties(JsonObject json, Resource res) throws IOException, FHIRFormatError {
1753    if (json.has("id"))
1754      res.setIdElement(parseId(json.get("id").getAsString()));
1755    if (json.has("_id"))
1756      parseElementProperties(getJObject(json, "_id"), res.getIdElement());
1757    if (json.has("meta"))
1758      res.setMeta(parseMeta(getJObject(json, "meta")));
1759    if (json.has("implicitRules"))
1760      res.setImplicitRulesElement(parseUri(json.get("implicitRules").getAsString()));
1761    if (json.has("_implicitRules"))
1762      parseElementProperties(getJObject(json, "_implicitRules"), res.getImplicitRulesElement());
1763    if (json.has("language"))
1764      res.setLanguageElement(parseCode(json.get("language").getAsString()));
1765    if (json.has("_language"))
1766      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
1767  }
1768
1769  protected Account parseAccount(JsonObject json) throws IOException, FHIRFormatError {
1770    Account res = new Account();
1771    parseAccountProperties(json, res);
1772    return res;
1773  }
1774
1775  protected void parseAccountProperties(JsonObject json, Account res) throws IOException, FHIRFormatError {
1776    parseDomainResourceProperties(json, res);
1777    if (json.has("identifier")) {
1778      JsonArray array = json.getAsJsonArray("identifier");
1779      for (int i = 0; i < array.size(); i++) {
1780        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
1781      }
1782    };
1783    if (json.has("status"))
1784      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Account.AccountStatus.NULL, new Account.AccountStatusEnumFactory()));
1785    if (json.has("_status"))
1786      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
1787    if (json.has("type"))
1788      res.setType(parseCodeableConcept(getJObject(json, "type")));
1789    if (json.has("name"))
1790      res.setNameElement(parseString(json.get("name").getAsString()));
1791    if (json.has("_name"))
1792      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
1793    if (json.has("subject"))
1794      res.setSubject(parseReference(getJObject(json, "subject")));
1795    if (json.has("period"))
1796      res.setPeriod(parsePeriod(getJObject(json, "period")));
1797    if (json.has("active"))
1798      res.setActive(parsePeriod(getJObject(json, "active")));
1799    if (json.has("balance"))
1800      res.setBalance(parseMoney(getJObject(json, "balance")));
1801    if (json.has("coverage")) {
1802      JsonArray array = json.getAsJsonArray("coverage");
1803      for (int i = 0; i < array.size(); i++) {
1804        res.getCoverage().add(parseAccountCoverageComponent(array.get(i).getAsJsonObject(), res));
1805      }
1806    };
1807    if (json.has("owner"))
1808      res.setOwner(parseReference(getJObject(json, "owner")));
1809    if (json.has("description"))
1810      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1811    if (json.has("_description"))
1812      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
1813    if (json.has("guarantor")) {
1814      JsonArray array = json.getAsJsonArray("guarantor");
1815      for (int i = 0; i < array.size(); i++) {
1816        res.getGuarantor().add(parseAccountGuarantorComponent(array.get(i).getAsJsonObject(), res));
1817      }
1818    };
1819  }
1820
1821  protected Account.CoverageComponent parseAccountCoverageComponent(JsonObject json, Account owner) throws IOException, FHIRFormatError {
1822    Account.CoverageComponent res = new Account.CoverageComponent();
1823    parseAccountCoverageComponentProperties(json, owner, res);
1824    return res;
1825  }
1826
1827  protected void parseAccountCoverageComponentProperties(JsonObject json, Account owner, Account.CoverageComponent res) throws IOException, FHIRFormatError {
1828    parseBackboneProperties(json, res);
1829    if (json.has("coverage"))
1830      res.setCoverage(parseReference(getJObject(json, "coverage")));
1831    if (json.has("priority"))
1832      res.setPriorityElement(parsePositiveInt(json.get("priority").getAsString()));
1833    if (json.has("_priority"))
1834      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
1835  }
1836
1837  protected Account.GuarantorComponent parseAccountGuarantorComponent(JsonObject json, Account owner) throws IOException, FHIRFormatError {
1838    Account.GuarantorComponent res = new Account.GuarantorComponent();
1839    parseAccountGuarantorComponentProperties(json, owner, res);
1840    return res;
1841  }
1842
1843  protected void parseAccountGuarantorComponentProperties(JsonObject json, Account owner, Account.GuarantorComponent res) throws IOException, FHIRFormatError {
1844    parseBackboneProperties(json, res);
1845    if (json.has("party"))
1846      res.setParty(parseReference(getJObject(json, "party")));
1847    if (json.has("onHold"))
1848      res.setOnHoldElement(parseBoolean(json.get("onHold").getAsBoolean()));
1849    if (json.has("_onHold"))
1850      parseElementProperties(getJObject(json, "_onHold"), res.getOnHoldElement());
1851    if (json.has("period"))
1852      res.setPeriod(parsePeriod(getJObject(json, "period")));
1853  }
1854
1855  protected ActivityDefinition parseActivityDefinition(JsonObject json) throws IOException, FHIRFormatError {
1856    ActivityDefinition res = new ActivityDefinition();
1857    parseActivityDefinitionProperties(json, res);
1858    return res;
1859  }
1860
1861  protected void parseActivityDefinitionProperties(JsonObject json, ActivityDefinition res) throws IOException, FHIRFormatError {
1862    parseDomainResourceProperties(json, res);
1863    if (json.has("url"))
1864      res.setUrlElement(parseUri(json.get("url").getAsString()));
1865    if (json.has("_url"))
1866      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
1867    if (json.has("identifier")) {
1868      JsonArray array = json.getAsJsonArray("identifier");
1869      for (int i = 0; i < array.size(); i++) {
1870        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
1871      }
1872    };
1873    if (json.has("version"))
1874      res.setVersionElement(parseString(json.get("version").getAsString()));
1875    if (json.has("_version"))
1876      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
1877    if (json.has("name"))
1878      res.setNameElement(parseString(json.get("name").getAsString()));
1879    if (json.has("_name"))
1880      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
1881    if (json.has("title"))
1882      res.setTitleElement(parseString(json.get("title").getAsString()));
1883    if (json.has("_title"))
1884      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
1885    if (json.has("status"))
1886      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
1887    if (json.has("_status"))
1888      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
1889    if (json.has("experimental"))
1890      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
1891    if (json.has("_experimental"))
1892      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
1893    if (json.has("date"))
1894      res.setDateElement(parseDateTime(json.get("date").getAsString()));
1895    if (json.has("_date"))
1896      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
1897    if (json.has("publisher"))
1898      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
1899    if (json.has("_publisher"))
1900      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
1901    if (json.has("description"))
1902      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
1903    if (json.has("_description"))
1904      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
1905    if (json.has("purpose"))
1906      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
1907    if (json.has("_purpose"))
1908      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
1909    if (json.has("usage"))
1910      res.setUsageElement(parseString(json.get("usage").getAsString()));
1911    if (json.has("_usage"))
1912      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
1913    if (json.has("approvalDate"))
1914      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
1915    if (json.has("_approvalDate"))
1916      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
1917    if (json.has("lastReviewDate"))
1918      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
1919    if (json.has("_lastReviewDate"))
1920      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
1921    if (json.has("effectivePeriod"))
1922      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
1923    if (json.has("useContext")) {
1924      JsonArray array = json.getAsJsonArray("useContext");
1925      for (int i = 0; i < array.size(); i++) {
1926        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
1927      }
1928    };
1929    if (json.has("jurisdiction")) {
1930      JsonArray array = json.getAsJsonArray("jurisdiction");
1931      for (int i = 0; i < array.size(); i++) {
1932        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1933      }
1934    };
1935    if (json.has("topic")) {
1936      JsonArray array = json.getAsJsonArray("topic");
1937      for (int i = 0; i < array.size(); i++) {
1938        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1939      }
1940    };
1941    if (json.has("contributor")) {
1942      JsonArray array = json.getAsJsonArray("contributor");
1943      for (int i = 0; i < array.size(); i++) {
1944        res.getContributor().add(parseContributor(array.get(i).getAsJsonObject()));
1945      }
1946    };
1947    if (json.has("contact")) {
1948      JsonArray array = json.getAsJsonArray("contact");
1949      for (int i = 0; i < array.size(); i++) {
1950        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
1951      }
1952    };
1953    if (json.has("copyright"))
1954      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
1955    if (json.has("_copyright"))
1956      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
1957    if (json.has("relatedArtifact")) {
1958      JsonArray array = json.getAsJsonArray("relatedArtifact");
1959      for (int i = 0; i < array.size(); i++) {
1960        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
1961      }
1962    };
1963    if (json.has("library")) {
1964      JsonArray array = json.getAsJsonArray("library");
1965      for (int i = 0; i < array.size(); i++) {
1966        res.getLibrary().add(parseReference(array.get(i).getAsJsonObject()));
1967      }
1968    };
1969    if (json.has("kind"))
1970      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), ActivityDefinition.ActivityDefinitionKind.NULL, new ActivityDefinition.ActivityDefinitionKindEnumFactory()));
1971    if (json.has("_kind"))
1972      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
1973    if (json.has("code"))
1974      res.setCode(parseCodeableConcept(getJObject(json, "code")));
1975    Type timing = parseType("timing", json);
1976    if (timing != null)
1977      res.setTiming(timing);
1978    if (json.has("location"))
1979      res.setLocation(parseReference(getJObject(json, "location")));
1980    if (json.has("participant")) {
1981      JsonArray array = json.getAsJsonArray("participant");
1982      for (int i = 0; i < array.size(); i++) {
1983        res.getParticipant().add(parseActivityDefinitionActivityDefinitionParticipantComponent(array.get(i).getAsJsonObject(), res));
1984      }
1985    };
1986    Type product = parseType("product", json);
1987    if (product != null)
1988      res.setProduct(product);
1989    if (json.has("quantity"))
1990      res.setQuantity(parseSimpleQuantity(getJObject(json, "quantity")));
1991    if (json.has("dosage")) {
1992      JsonArray array = json.getAsJsonArray("dosage");
1993      for (int i = 0; i < array.size(); i++) {
1994        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
1995      }
1996    };
1997    if (json.has("bodySite")) {
1998      JsonArray array = json.getAsJsonArray("bodySite");
1999      for (int i = 0; i < array.size(); i++) {
2000        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2001      }
2002    };
2003    if (json.has("transform"))
2004      res.setTransform(parseReference(getJObject(json, "transform")));
2005    if (json.has("dynamicValue")) {
2006      JsonArray array = json.getAsJsonArray("dynamicValue");
2007      for (int i = 0; i < array.size(); i++) {
2008        res.getDynamicValue().add(parseActivityDefinitionActivityDefinitionDynamicValueComponent(array.get(i).getAsJsonObject(), res));
2009      }
2010    };
2011  }
2012
2013  protected ActivityDefinition.ActivityDefinitionParticipantComponent parseActivityDefinitionActivityDefinitionParticipantComponent(JsonObject json, ActivityDefinition owner) throws IOException, FHIRFormatError {
2014    ActivityDefinition.ActivityDefinitionParticipantComponent res = new ActivityDefinition.ActivityDefinitionParticipantComponent();
2015    parseActivityDefinitionActivityDefinitionParticipantComponentProperties(json, owner, res);
2016    return res;
2017  }
2018
2019  protected void parseActivityDefinitionActivityDefinitionParticipantComponentProperties(JsonObject json, ActivityDefinition owner, ActivityDefinition.ActivityDefinitionParticipantComponent res) throws IOException, FHIRFormatError {
2020    parseBackboneProperties(json, res);
2021    if (json.has("type"))
2022      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ActivityDefinition.ActivityParticipantType.NULL, new ActivityDefinition.ActivityParticipantTypeEnumFactory()));
2023    if (json.has("_type"))
2024      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
2025    if (json.has("role"))
2026      res.setRole(parseCodeableConcept(getJObject(json, "role")));
2027  }
2028
2029  protected ActivityDefinition.ActivityDefinitionDynamicValueComponent parseActivityDefinitionActivityDefinitionDynamicValueComponent(JsonObject json, ActivityDefinition owner) throws IOException, FHIRFormatError {
2030    ActivityDefinition.ActivityDefinitionDynamicValueComponent res = new ActivityDefinition.ActivityDefinitionDynamicValueComponent();
2031    parseActivityDefinitionActivityDefinitionDynamicValueComponentProperties(json, owner, res);
2032    return res;
2033  }
2034
2035  protected void parseActivityDefinitionActivityDefinitionDynamicValueComponentProperties(JsonObject json, ActivityDefinition owner, ActivityDefinition.ActivityDefinitionDynamicValueComponent res) throws IOException, FHIRFormatError {
2036    parseBackboneProperties(json, res);
2037    if (json.has("description"))
2038      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2039    if (json.has("_description"))
2040      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2041    if (json.has("path"))
2042      res.setPathElement(parseString(json.get("path").getAsString()));
2043    if (json.has("_path"))
2044      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
2045    if (json.has("language"))
2046      res.setLanguageElement(parseString(json.get("language").getAsString()));
2047    if (json.has("_language"))
2048      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
2049    if (json.has("expression"))
2050      res.setExpressionElement(parseString(json.get("expression").getAsString()));
2051    if (json.has("_expression"))
2052      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
2053  }
2054
2055  protected AdverseEvent parseAdverseEvent(JsonObject json) throws IOException, FHIRFormatError {
2056    AdverseEvent res = new AdverseEvent();
2057    parseAdverseEventProperties(json, res);
2058    return res;
2059  }
2060
2061  protected void parseAdverseEventProperties(JsonObject json, AdverseEvent res) throws IOException, FHIRFormatError {
2062    parseDomainResourceProperties(json, res);
2063    if (json.has("identifier"))
2064      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
2065    if (json.has("category"))
2066      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), AdverseEvent.AdverseEventCategory.NULL, new AdverseEvent.AdverseEventCategoryEnumFactory()));
2067    if (json.has("_category"))
2068      parseElementProperties(getJObject(json, "_category"), res.getCategoryElement());
2069    if (json.has("type"))
2070      res.setType(parseCodeableConcept(getJObject(json, "type")));
2071    if (json.has("subject"))
2072      res.setSubject(parseReference(getJObject(json, "subject")));
2073    if (json.has("date"))
2074      res.setDateElement(parseDateTime(json.get("date").getAsString()));
2075    if (json.has("_date"))
2076      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
2077    if (json.has("reaction")) {
2078      JsonArray array = json.getAsJsonArray("reaction");
2079      for (int i = 0; i < array.size(); i++) {
2080        res.getReaction().add(parseReference(array.get(i).getAsJsonObject()));
2081      }
2082    };
2083    if (json.has("location"))
2084      res.setLocation(parseReference(getJObject(json, "location")));
2085    if (json.has("seriousness"))
2086      res.setSeriousness(parseCodeableConcept(getJObject(json, "seriousness")));
2087    if (json.has("outcome"))
2088      res.setOutcome(parseCodeableConcept(getJObject(json, "outcome")));
2089    if (json.has("recorder"))
2090      res.setRecorder(parseReference(getJObject(json, "recorder")));
2091    if (json.has("eventParticipant"))
2092      res.setEventParticipant(parseReference(getJObject(json, "eventParticipant")));
2093    if (json.has("description"))
2094      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2095    if (json.has("_description"))
2096      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2097    if (json.has("suspectEntity")) {
2098      JsonArray array = json.getAsJsonArray("suspectEntity");
2099      for (int i = 0; i < array.size(); i++) {
2100        res.getSuspectEntity().add(parseAdverseEventAdverseEventSuspectEntityComponent(array.get(i).getAsJsonObject(), res));
2101      }
2102    };
2103    if (json.has("subjectMedicalHistory")) {
2104      JsonArray array = json.getAsJsonArray("subjectMedicalHistory");
2105      for (int i = 0; i < array.size(); i++) {
2106        res.getSubjectMedicalHistory().add(parseReference(array.get(i).getAsJsonObject()));
2107      }
2108    };
2109    if (json.has("referenceDocument")) {
2110      JsonArray array = json.getAsJsonArray("referenceDocument");
2111      for (int i = 0; i < array.size(); i++) {
2112        res.getReferenceDocument().add(parseReference(array.get(i).getAsJsonObject()));
2113      }
2114    };
2115    if (json.has("study")) {
2116      JsonArray array = json.getAsJsonArray("study");
2117      for (int i = 0; i < array.size(); i++) {
2118        res.getStudy().add(parseReference(array.get(i).getAsJsonObject()));
2119      }
2120    };
2121  }
2122
2123  protected AdverseEvent.AdverseEventSuspectEntityComponent parseAdverseEventAdverseEventSuspectEntityComponent(JsonObject json, AdverseEvent owner) throws IOException, FHIRFormatError {
2124    AdverseEvent.AdverseEventSuspectEntityComponent res = new AdverseEvent.AdverseEventSuspectEntityComponent();
2125    parseAdverseEventAdverseEventSuspectEntityComponentProperties(json, owner, res);
2126    return res;
2127  }
2128
2129  protected void parseAdverseEventAdverseEventSuspectEntityComponentProperties(JsonObject json, AdverseEvent owner, AdverseEvent.AdverseEventSuspectEntityComponent res) throws IOException, FHIRFormatError {
2130    parseBackboneProperties(json, res);
2131    if (json.has("instance"))
2132      res.setInstance(parseReference(getJObject(json, "instance")));
2133    if (json.has("causality"))
2134      res.setCausalityElement(parseEnumeration(json.get("causality").getAsString(), AdverseEvent.AdverseEventCausality.NULL, new AdverseEvent.AdverseEventCausalityEnumFactory()));
2135    if (json.has("_causality"))
2136      parseElementProperties(getJObject(json, "_causality"), res.getCausalityElement());
2137    if (json.has("causalityAssessment"))
2138      res.setCausalityAssessment(parseCodeableConcept(getJObject(json, "causalityAssessment")));
2139    if (json.has("causalityProductRelatedness"))
2140      res.setCausalityProductRelatednessElement(parseString(json.get("causalityProductRelatedness").getAsString()));
2141    if (json.has("_causalityProductRelatedness"))
2142      parseElementProperties(getJObject(json, "_causalityProductRelatedness"), res.getCausalityProductRelatednessElement());
2143    if (json.has("causalityMethod"))
2144      res.setCausalityMethod(parseCodeableConcept(getJObject(json, "causalityMethod")));
2145    if (json.has("causalityAuthor"))
2146      res.setCausalityAuthor(parseReference(getJObject(json, "causalityAuthor")));
2147    if (json.has("causalityResult"))
2148      res.setCausalityResult(parseCodeableConcept(getJObject(json, "causalityResult")));
2149  }
2150
2151  protected AllergyIntolerance parseAllergyIntolerance(JsonObject json) throws IOException, FHIRFormatError {
2152    AllergyIntolerance res = new AllergyIntolerance();
2153    parseAllergyIntoleranceProperties(json, res);
2154    return res;
2155  }
2156
2157  protected void parseAllergyIntoleranceProperties(JsonObject json, AllergyIntolerance res) throws IOException, FHIRFormatError {
2158    parseDomainResourceProperties(json, res);
2159    if (json.has("identifier")) {
2160      JsonArray array = json.getAsJsonArray("identifier");
2161      for (int i = 0; i < array.size(); i++) {
2162        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2163      }
2164    };
2165    if (json.has("clinicalStatus"))
2166      res.setClinicalStatusElement(parseEnumeration(json.get("clinicalStatus").getAsString(), AllergyIntolerance.AllergyIntoleranceClinicalStatus.NULL, new AllergyIntolerance.AllergyIntoleranceClinicalStatusEnumFactory()));
2167    if (json.has("_clinicalStatus"))
2168      parseElementProperties(getJObject(json, "_clinicalStatus"), res.getClinicalStatusElement());
2169    if (json.has("verificationStatus"))
2170      res.setVerificationStatusElement(parseEnumeration(json.get("verificationStatus").getAsString(), AllergyIntolerance.AllergyIntoleranceVerificationStatus.NULL, new AllergyIntolerance.AllergyIntoleranceVerificationStatusEnumFactory()));
2171    if (json.has("_verificationStatus"))
2172      parseElementProperties(getJObject(json, "_verificationStatus"), res.getVerificationStatusElement());
2173    if (json.has("type"))
2174      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), AllergyIntolerance.AllergyIntoleranceType.NULL, new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory()));
2175    if (json.has("_type"))
2176      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
2177    if (json.has("category")) {
2178      JsonArray array = json.getAsJsonArray("category");
2179      for (int i = 0; i < array.size(); i++) {
2180        if (array.get(i).isJsonNull()) {
2181          res.getCategory().add(new Enumeration<AllergyIntolerance.AllergyIntoleranceCategory>());
2182        } else {
2183          res.getCategory().add(parseEnumeration(array.get(i).getAsString(), AllergyIntolerance.AllergyIntoleranceCategory.NULL, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
2184        }
2185      }
2186    };
2187    if (json.has("_category")) {
2188      JsonArray array = json.getAsJsonArray("_category");
2189      for (int i = 0; i < array.size(); i++) {
2190        if (i == res.getCategory().size())
2191          res.getCategory().add(parseEnumeration(null, AllergyIntolerance.AllergyIntoleranceCategory.NULL, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
2192        if (array.get(i) instanceof JsonObject) 
2193          parseElementProperties(array.get(i).getAsJsonObject(), res.getCategory().get(i));
2194      }
2195    };
2196    if (json.has("criticality"))
2197      res.setCriticalityElement(parseEnumeration(json.get("criticality").getAsString(), AllergyIntolerance.AllergyIntoleranceCriticality.NULL, new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory()));
2198    if (json.has("_criticality"))
2199      parseElementProperties(getJObject(json, "_criticality"), res.getCriticalityElement());
2200    if (json.has("code"))
2201      res.setCode(parseCodeableConcept(getJObject(json, "code")));
2202    if (json.has("patient"))
2203      res.setPatient(parseReference(getJObject(json, "patient")));
2204    Type onset = parseType("onset", json);
2205    if (onset != null)
2206      res.setOnset(onset);
2207    if (json.has("assertedDate"))
2208      res.setAssertedDateElement(parseDateTime(json.get("assertedDate").getAsString()));
2209    if (json.has("_assertedDate"))
2210      parseElementProperties(getJObject(json, "_assertedDate"), res.getAssertedDateElement());
2211    if (json.has("recorder"))
2212      res.setRecorder(parseReference(getJObject(json, "recorder")));
2213    if (json.has("asserter"))
2214      res.setAsserter(parseReference(getJObject(json, "asserter")));
2215    if (json.has("lastOccurrence"))
2216      res.setLastOccurrenceElement(parseDateTime(json.get("lastOccurrence").getAsString()));
2217    if (json.has("_lastOccurrence"))
2218      parseElementProperties(getJObject(json, "_lastOccurrence"), res.getLastOccurrenceElement());
2219    if (json.has("note")) {
2220      JsonArray array = json.getAsJsonArray("note");
2221      for (int i = 0; i < array.size(); i++) {
2222        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
2223      }
2224    };
2225    if (json.has("reaction")) {
2226      JsonArray array = json.getAsJsonArray("reaction");
2227      for (int i = 0; i < array.size(); i++) {
2228        res.getReaction().add(parseAllergyIntoleranceAllergyIntoleranceReactionComponent(array.get(i).getAsJsonObject(), res));
2229      }
2230    };
2231  }
2232
2233  protected AllergyIntolerance.AllergyIntoleranceReactionComponent parseAllergyIntoleranceAllergyIntoleranceReactionComponent(JsonObject json, AllergyIntolerance owner) throws IOException, FHIRFormatError {
2234    AllergyIntolerance.AllergyIntoleranceReactionComponent res = new AllergyIntolerance.AllergyIntoleranceReactionComponent();
2235    parseAllergyIntoleranceAllergyIntoleranceReactionComponentProperties(json, owner, res);
2236    return res;
2237  }
2238
2239  protected void parseAllergyIntoleranceAllergyIntoleranceReactionComponentProperties(JsonObject json, AllergyIntolerance owner, AllergyIntolerance.AllergyIntoleranceReactionComponent res) throws IOException, FHIRFormatError {
2240    parseBackboneProperties(json, res);
2241    if (json.has("substance"))
2242      res.setSubstance(parseCodeableConcept(getJObject(json, "substance")));
2243    if (json.has("manifestation")) {
2244      JsonArray array = json.getAsJsonArray("manifestation");
2245      for (int i = 0; i < array.size(); i++) {
2246        res.getManifestation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2247      }
2248    };
2249    if (json.has("description"))
2250      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2251    if (json.has("_description"))
2252      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2253    if (json.has("onset"))
2254      res.setOnsetElement(parseDateTime(json.get("onset").getAsString()));
2255    if (json.has("_onset"))
2256      parseElementProperties(getJObject(json, "_onset"), res.getOnsetElement());
2257    if (json.has("severity"))
2258      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), AllergyIntolerance.AllergyIntoleranceSeverity.NULL, new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory()));
2259    if (json.has("_severity"))
2260      parseElementProperties(getJObject(json, "_severity"), res.getSeverityElement());
2261    if (json.has("exposureRoute"))
2262      res.setExposureRoute(parseCodeableConcept(getJObject(json, "exposureRoute")));
2263    if (json.has("note")) {
2264      JsonArray array = json.getAsJsonArray("note");
2265      for (int i = 0; i < array.size(); i++) {
2266        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
2267      }
2268    };
2269  }
2270
2271  protected Appointment parseAppointment(JsonObject json) throws IOException, FHIRFormatError {
2272    Appointment res = new Appointment();
2273    parseAppointmentProperties(json, res);
2274    return res;
2275  }
2276
2277  protected void parseAppointmentProperties(JsonObject json, Appointment res) throws IOException, FHIRFormatError {
2278    parseDomainResourceProperties(json, res);
2279    if (json.has("identifier")) {
2280      JsonArray array = json.getAsJsonArray("identifier");
2281      for (int i = 0; i < array.size(); i++) {
2282        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2283      }
2284    };
2285    if (json.has("status"))
2286      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Appointment.AppointmentStatus.NULL, new Appointment.AppointmentStatusEnumFactory()));
2287    if (json.has("_status"))
2288      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
2289    if (json.has("serviceCategory"))
2290      res.setServiceCategory(parseCodeableConcept(getJObject(json, "serviceCategory")));
2291    if (json.has("serviceType")) {
2292      JsonArray array = json.getAsJsonArray("serviceType");
2293      for (int i = 0; i < array.size(); i++) {
2294        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2295      }
2296    };
2297    if (json.has("specialty")) {
2298      JsonArray array = json.getAsJsonArray("specialty");
2299      for (int i = 0; i < array.size(); i++) {
2300        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2301      }
2302    };
2303    if (json.has("appointmentType"))
2304      res.setAppointmentType(parseCodeableConcept(getJObject(json, "appointmentType")));
2305    if (json.has("reason")) {
2306      JsonArray array = json.getAsJsonArray("reason");
2307      for (int i = 0; i < array.size(); i++) {
2308        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2309      }
2310    };
2311    if (json.has("indication")) {
2312      JsonArray array = json.getAsJsonArray("indication");
2313      for (int i = 0; i < array.size(); i++) {
2314        res.getIndication().add(parseReference(array.get(i).getAsJsonObject()));
2315      }
2316    };
2317    if (json.has("priority"))
2318      res.setPriorityElement(parseUnsignedInt(json.get("priority").getAsString()));
2319    if (json.has("_priority"))
2320      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
2321    if (json.has("description"))
2322      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2323    if (json.has("_description"))
2324      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2325    if (json.has("supportingInformation")) {
2326      JsonArray array = json.getAsJsonArray("supportingInformation");
2327      for (int i = 0; i < array.size(); i++) {
2328        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
2329      }
2330    };
2331    if (json.has("start"))
2332      res.setStartElement(parseInstant(json.get("start").getAsString()));
2333    if (json.has("_start"))
2334      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
2335    if (json.has("end"))
2336      res.setEndElement(parseInstant(json.get("end").getAsString()));
2337    if (json.has("_end"))
2338      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
2339    if (json.has("minutesDuration"))
2340      res.setMinutesDurationElement(parsePositiveInt(json.get("minutesDuration").getAsString()));
2341    if (json.has("_minutesDuration"))
2342      parseElementProperties(getJObject(json, "_minutesDuration"), res.getMinutesDurationElement());
2343    if (json.has("slot")) {
2344      JsonArray array = json.getAsJsonArray("slot");
2345      for (int i = 0; i < array.size(); i++) {
2346        res.getSlot().add(parseReference(array.get(i).getAsJsonObject()));
2347      }
2348    };
2349    if (json.has("created"))
2350      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
2351    if (json.has("_created"))
2352      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
2353    if (json.has("comment"))
2354      res.setCommentElement(parseString(json.get("comment").getAsString()));
2355    if (json.has("_comment"))
2356      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
2357    if (json.has("incomingReferral")) {
2358      JsonArray array = json.getAsJsonArray("incomingReferral");
2359      for (int i = 0; i < array.size(); i++) {
2360        res.getIncomingReferral().add(parseReference(array.get(i).getAsJsonObject()));
2361      }
2362    };
2363    if (json.has("participant")) {
2364      JsonArray array = json.getAsJsonArray("participant");
2365      for (int i = 0; i < array.size(); i++) {
2366        res.getParticipant().add(parseAppointmentAppointmentParticipantComponent(array.get(i).getAsJsonObject(), res));
2367      }
2368    };
2369    if (json.has("requestedPeriod")) {
2370      JsonArray array = json.getAsJsonArray("requestedPeriod");
2371      for (int i = 0; i < array.size(); i++) {
2372        res.getRequestedPeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
2373      }
2374    };
2375  }
2376
2377  protected Appointment.AppointmentParticipantComponent parseAppointmentAppointmentParticipantComponent(JsonObject json, Appointment owner) throws IOException, FHIRFormatError {
2378    Appointment.AppointmentParticipantComponent res = new Appointment.AppointmentParticipantComponent();
2379    parseAppointmentAppointmentParticipantComponentProperties(json, owner, res);
2380    return res;
2381  }
2382
2383  protected void parseAppointmentAppointmentParticipantComponentProperties(JsonObject json, Appointment owner, Appointment.AppointmentParticipantComponent res) throws IOException, FHIRFormatError {
2384    parseBackboneProperties(json, res);
2385    if (json.has("type")) {
2386      JsonArray array = json.getAsJsonArray("type");
2387      for (int i = 0; i < array.size(); i++) {
2388        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2389      }
2390    };
2391    if (json.has("actor"))
2392      res.setActor(parseReference(getJObject(json, "actor")));
2393    if (json.has("required"))
2394      res.setRequiredElement(parseEnumeration(json.get("required").getAsString(), Appointment.ParticipantRequired.NULL, new Appointment.ParticipantRequiredEnumFactory()));
2395    if (json.has("_required"))
2396      parseElementProperties(getJObject(json, "_required"), res.getRequiredElement());
2397    if (json.has("status"))
2398      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Appointment.ParticipationStatus.NULL, new Appointment.ParticipationStatusEnumFactory()));
2399    if (json.has("_status"))
2400      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
2401  }
2402
2403  protected AppointmentResponse parseAppointmentResponse(JsonObject json) throws IOException, FHIRFormatError {
2404    AppointmentResponse res = new AppointmentResponse();
2405    parseAppointmentResponseProperties(json, res);
2406    return res;
2407  }
2408
2409  protected void parseAppointmentResponseProperties(JsonObject json, AppointmentResponse res) throws IOException, FHIRFormatError {
2410    parseDomainResourceProperties(json, res);
2411    if (json.has("identifier")) {
2412      JsonArray array = json.getAsJsonArray("identifier");
2413      for (int i = 0; i < array.size(); i++) {
2414        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2415      }
2416    };
2417    if (json.has("appointment"))
2418      res.setAppointment(parseReference(getJObject(json, "appointment")));
2419    if (json.has("start"))
2420      res.setStartElement(parseInstant(json.get("start").getAsString()));
2421    if (json.has("_start"))
2422      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
2423    if (json.has("end"))
2424      res.setEndElement(parseInstant(json.get("end").getAsString()));
2425    if (json.has("_end"))
2426      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
2427    if (json.has("participantType")) {
2428      JsonArray array = json.getAsJsonArray("participantType");
2429      for (int i = 0; i < array.size(); i++) {
2430        res.getParticipantType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2431      }
2432    };
2433    if (json.has("actor"))
2434      res.setActor(parseReference(getJObject(json, "actor")));
2435    if (json.has("participantStatus"))
2436      res.setParticipantStatusElement(parseEnumeration(json.get("participantStatus").getAsString(), AppointmentResponse.ParticipantStatus.NULL, new AppointmentResponse.ParticipantStatusEnumFactory()));
2437    if (json.has("_participantStatus"))
2438      parseElementProperties(getJObject(json, "_participantStatus"), res.getParticipantStatusElement());
2439    if (json.has("comment"))
2440      res.setCommentElement(parseString(json.get("comment").getAsString()));
2441    if (json.has("_comment"))
2442      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
2443  }
2444
2445  protected AuditEvent parseAuditEvent(JsonObject json) throws IOException, FHIRFormatError {
2446    AuditEvent res = new AuditEvent();
2447    parseAuditEventProperties(json, res);
2448    return res;
2449  }
2450
2451  protected void parseAuditEventProperties(JsonObject json, AuditEvent res) throws IOException, FHIRFormatError {
2452    parseDomainResourceProperties(json, res);
2453    if (json.has("type"))
2454      res.setType(parseCoding(getJObject(json, "type")));
2455    if (json.has("subtype")) {
2456      JsonArray array = json.getAsJsonArray("subtype");
2457      for (int i = 0; i < array.size(); i++) {
2458        res.getSubtype().add(parseCoding(array.get(i).getAsJsonObject()));
2459      }
2460    };
2461    if (json.has("action"))
2462      res.setActionElement(parseEnumeration(json.get("action").getAsString(), AuditEvent.AuditEventAction.NULL, new AuditEvent.AuditEventActionEnumFactory()));
2463    if (json.has("_action"))
2464      parseElementProperties(getJObject(json, "_action"), res.getActionElement());
2465    if (json.has("recorded"))
2466      res.setRecordedElement(parseInstant(json.get("recorded").getAsString()));
2467    if (json.has("_recorded"))
2468      parseElementProperties(getJObject(json, "_recorded"), res.getRecordedElement());
2469    if (json.has("outcome"))
2470      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), AuditEvent.AuditEventOutcome.NULL, new AuditEvent.AuditEventOutcomeEnumFactory()));
2471    if (json.has("_outcome"))
2472      parseElementProperties(getJObject(json, "_outcome"), res.getOutcomeElement());
2473    if (json.has("outcomeDesc"))
2474      res.setOutcomeDescElement(parseString(json.get("outcomeDesc").getAsString()));
2475    if (json.has("_outcomeDesc"))
2476      parseElementProperties(getJObject(json, "_outcomeDesc"), res.getOutcomeDescElement());
2477    if (json.has("purposeOfEvent")) {
2478      JsonArray array = json.getAsJsonArray("purposeOfEvent");
2479      for (int i = 0; i < array.size(); i++) {
2480        res.getPurposeOfEvent().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2481      }
2482    };
2483    if (json.has("agent")) {
2484      JsonArray array = json.getAsJsonArray("agent");
2485      for (int i = 0; i < array.size(); i++) {
2486        res.getAgent().add(parseAuditEventAuditEventAgentComponent(array.get(i).getAsJsonObject(), res));
2487      }
2488    };
2489    if (json.has("source"))
2490      res.setSource(parseAuditEventAuditEventSourceComponent(getJObject(json, "source"), res));
2491    if (json.has("entity")) {
2492      JsonArray array = json.getAsJsonArray("entity");
2493      for (int i = 0; i < array.size(); i++) {
2494        res.getEntity().add(parseAuditEventAuditEventEntityComponent(array.get(i).getAsJsonObject(), res));
2495      }
2496    };
2497  }
2498
2499  protected AuditEvent.AuditEventAgentComponent parseAuditEventAuditEventAgentComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2500    AuditEvent.AuditEventAgentComponent res = new AuditEvent.AuditEventAgentComponent();
2501    parseAuditEventAuditEventAgentComponentProperties(json, owner, res);
2502    return res;
2503  }
2504
2505  protected void parseAuditEventAuditEventAgentComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventAgentComponent res) throws IOException, FHIRFormatError {
2506    parseBackboneProperties(json, res);
2507    if (json.has("role")) {
2508      JsonArray array = json.getAsJsonArray("role");
2509      for (int i = 0; i < array.size(); i++) {
2510        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2511      }
2512    };
2513    if (json.has("reference"))
2514      res.setReference(parseReference(getJObject(json, "reference")));
2515    if (json.has("userId"))
2516      res.setUserId(parseIdentifier(getJObject(json, "userId")));
2517    if (json.has("altId"))
2518      res.setAltIdElement(parseString(json.get("altId").getAsString()));
2519    if (json.has("_altId"))
2520      parseElementProperties(getJObject(json, "_altId"), res.getAltIdElement());
2521    if (json.has("name"))
2522      res.setNameElement(parseString(json.get("name").getAsString()));
2523    if (json.has("_name"))
2524      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
2525    if (json.has("requestor"))
2526      res.setRequestorElement(parseBoolean(json.get("requestor").getAsBoolean()));
2527    if (json.has("_requestor"))
2528      parseElementProperties(getJObject(json, "_requestor"), res.getRequestorElement());
2529    if (json.has("location"))
2530      res.setLocation(parseReference(getJObject(json, "location")));
2531    if (json.has("policy")) {
2532      JsonArray array = json.getAsJsonArray("policy");
2533      for (int i = 0; i < array.size(); i++) {
2534        if (array.get(i).isJsonNull()) {
2535          res.getPolicy().add(new UriType());
2536        } else {
2537          res.getPolicy().add(parseUri(array.get(i).getAsString()));
2538        }
2539      }
2540    };
2541    if (json.has("_policy")) {
2542      JsonArray array = json.getAsJsonArray("_policy");
2543      for (int i = 0; i < array.size(); i++) {
2544        if (i == res.getPolicy().size())
2545          res.getPolicy().add(parseUri(null));
2546        if (array.get(i) instanceof JsonObject) 
2547          parseElementProperties(array.get(i).getAsJsonObject(), res.getPolicy().get(i));
2548      }
2549    };
2550    if (json.has("media"))
2551      res.setMedia(parseCoding(getJObject(json, "media")));
2552    if (json.has("network"))
2553      res.setNetwork(parseAuditEventAuditEventAgentNetworkComponent(getJObject(json, "network"), owner));
2554    if (json.has("purposeOfUse")) {
2555      JsonArray array = json.getAsJsonArray("purposeOfUse");
2556      for (int i = 0; i < array.size(); i++) {
2557        res.getPurposeOfUse().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2558      }
2559    };
2560  }
2561
2562  protected AuditEvent.AuditEventAgentNetworkComponent parseAuditEventAuditEventAgentNetworkComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2563    AuditEvent.AuditEventAgentNetworkComponent res = new AuditEvent.AuditEventAgentNetworkComponent();
2564    parseAuditEventAuditEventAgentNetworkComponentProperties(json, owner, res);
2565    return res;
2566  }
2567
2568  protected void parseAuditEventAuditEventAgentNetworkComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventAgentNetworkComponent res) throws IOException, FHIRFormatError {
2569    parseBackboneProperties(json, res);
2570    if (json.has("address"))
2571      res.setAddressElement(parseString(json.get("address").getAsString()));
2572    if (json.has("_address"))
2573      parseElementProperties(getJObject(json, "_address"), res.getAddressElement());
2574    if (json.has("type"))
2575      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), AuditEvent.AuditEventAgentNetworkType.NULL, new AuditEvent.AuditEventAgentNetworkTypeEnumFactory()));
2576    if (json.has("_type"))
2577      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
2578  }
2579
2580  protected AuditEvent.AuditEventSourceComponent parseAuditEventAuditEventSourceComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2581    AuditEvent.AuditEventSourceComponent res = new AuditEvent.AuditEventSourceComponent();
2582    parseAuditEventAuditEventSourceComponentProperties(json, owner, res);
2583    return res;
2584  }
2585
2586  protected void parseAuditEventAuditEventSourceComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventSourceComponent res) throws IOException, FHIRFormatError {
2587    parseBackboneProperties(json, res);
2588    if (json.has("site"))
2589      res.setSiteElement(parseString(json.get("site").getAsString()));
2590    if (json.has("_site"))
2591      parseElementProperties(getJObject(json, "_site"), res.getSiteElement());
2592    if (json.has("identifier"))
2593      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
2594    if (json.has("type")) {
2595      JsonArray array = json.getAsJsonArray("type");
2596      for (int i = 0; i < array.size(); i++) {
2597        res.getType().add(parseCoding(array.get(i).getAsJsonObject()));
2598      }
2599    };
2600  }
2601
2602  protected AuditEvent.AuditEventEntityComponent parseAuditEventAuditEventEntityComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2603    AuditEvent.AuditEventEntityComponent res = new AuditEvent.AuditEventEntityComponent();
2604    parseAuditEventAuditEventEntityComponentProperties(json, owner, res);
2605    return res;
2606  }
2607
2608  protected void parseAuditEventAuditEventEntityComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventEntityComponent res) throws IOException, FHIRFormatError {
2609    parseBackboneProperties(json, res);
2610    if (json.has("identifier"))
2611      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
2612    if (json.has("reference"))
2613      res.setReference(parseReference(getJObject(json, "reference")));
2614    if (json.has("type"))
2615      res.setType(parseCoding(getJObject(json, "type")));
2616    if (json.has("role"))
2617      res.setRole(parseCoding(getJObject(json, "role")));
2618    if (json.has("lifecycle"))
2619      res.setLifecycle(parseCoding(getJObject(json, "lifecycle")));
2620    if (json.has("securityLabel")) {
2621      JsonArray array = json.getAsJsonArray("securityLabel");
2622      for (int i = 0; i < array.size(); i++) {
2623        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
2624      }
2625    };
2626    if (json.has("name"))
2627      res.setNameElement(parseString(json.get("name").getAsString()));
2628    if (json.has("_name"))
2629      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
2630    if (json.has("description"))
2631      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2632    if (json.has("_description"))
2633      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2634    if (json.has("query"))
2635      res.setQueryElement(parseBase64Binary(json.get("query").getAsString()));
2636    if (json.has("_query"))
2637      parseElementProperties(getJObject(json, "_query"), res.getQueryElement());
2638    if (json.has("detail")) {
2639      JsonArray array = json.getAsJsonArray("detail");
2640      for (int i = 0; i < array.size(); i++) {
2641        res.getDetail().add(parseAuditEventAuditEventEntityDetailComponent(array.get(i).getAsJsonObject(), owner));
2642      }
2643    };
2644  }
2645
2646  protected AuditEvent.AuditEventEntityDetailComponent parseAuditEventAuditEventEntityDetailComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2647    AuditEvent.AuditEventEntityDetailComponent res = new AuditEvent.AuditEventEntityDetailComponent();
2648    parseAuditEventAuditEventEntityDetailComponentProperties(json, owner, res);
2649    return res;
2650  }
2651
2652  protected void parseAuditEventAuditEventEntityDetailComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventEntityDetailComponent res) throws IOException, FHIRFormatError {
2653    parseBackboneProperties(json, res);
2654    if (json.has("type"))
2655      res.setTypeElement(parseString(json.get("type").getAsString()));
2656    if (json.has("_type"))
2657      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
2658    if (json.has("value"))
2659      res.setValueElement(parseBase64Binary(json.get("value").getAsString()));
2660    if (json.has("_value"))
2661      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
2662  }
2663
2664  protected Basic parseBasic(JsonObject json) throws IOException, FHIRFormatError {
2665    Basic res = new Basic();
2666    parseBasicProperties(json, res);
2667    return res;
2668  }
2669
2670  protected void parseBasicProperties(JsonObject json, Basic res) throws IOException, FHIRFormatError {
2671    parseDomainResourceProperties(json, res);
2672    if (json.has("identifier")) {
2673      JsonArray array = json.getAsJsonArray("identifier");
2674      for (int i = 0; i < array.size(); i++) {
2675        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2676      }
2677    };
2678    if (json.has("code"))
2679      res.setCode(parseCodeableConcept(getJObject(json, "code")));
2680    if (json.has("subject"))
2681      res.setSubject(parseReference(getJObject(json, "subject")));
2682    if (json.has("created"))
2683      res.setCreatedElement(parseDate(json.get("created").getAsString()));
2684    if (json.has("_created"))
2685      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
2686    if (json.has("author"))
2687      res.setAuthor(parseReference(getJObject(json, "author")));
2688  }
2689
2690  protected Binary parseBinary(JsonObject json) throws IOException, FHIRFormatError {
2691    Binary res = new Binary();
2692    parseBinaryProperties(json, res);
2693    return res;
2694  }
2695
2696  protected void parseBinaryProperties(JsonObject json, Binary res) throws IOException, FHIRFormatError {
2697    parseResourceProperties(json, res);
2698    if (json.has("contentType"))
2699      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
2700    if (json.has("_contentType"))
2701      parseElementProperties(getJObject(json, "_contentType"), res.getContentTypeElement());
2702    if (json.has("securityContext"))
2703      res.setSecurityContext(parseReference(getJObject(json, "securityContext")));
2704    if (json.has("content"))
2705      res.setContentElement(parseBase64Binary(json.get("content").getAsString()));
2706    if (json.has("_content"))
2707      parseElementProperties(getJObject(json, "_content"), res.getContentElement());
2708  }
2709
2710  protected BodySite parseBodySite(JsonObject json) throws IOException, FHIRFormatError {
2711    BodySite res = new BodySite();
2712    parseBodySiteProperties(json, res);
2713    return res;
2714  }
2715
2716  protected void parseBodySiteProperties(JsonObject json, BodySite res) throws IOException, FHIRFormatError {
2717    parseDomainResourceProperties(json, res);
2718    if (json.has("identifier")) {
2719      JsonArray array = json.getAsJsonArray("identifier");
2720      for (int i = 0; i < array.size(); i++) {
2721        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2722      }
2723    };
2724    if (json.has("active"))
2725      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
2726    if (json.has("_active"))
2727      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
2728    if (json.has("code"))
2729      res.setCode(parseCodeableConcept(getJObject(json, "code")));
2730    if (json.has("qualifier")) {
2731      JsonArray array = json.getAsJsonArray("qualifier");
2732      for (int i = 0; i < array.size(); i++) {
2733        res.getQualifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2734      }
2735    };
2736    if (json.has("description"))
2737      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2738    if (json.has("_description"))
2739      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2740    if (json.has("image")) {
2741      JsonArray array = json.getAsJsonArray("image");
2742      for (int i = 0; i < array.size(); i++) {
2743        res.getImage().add(parseAttachment(array.get(i).getAsJsonObject()));
2744      }
2745    };
2746    if (json.has("patient"))
2747      res.setPatient(parseReference(getJObject(json, "patient")));
2748  }
2749
2750  protected Bundle parseBundle(JsonObject json) throws IOException, FHIRFormatError {
2751    Bundle res = new Bundle();
2752    parseBundleProperties(json, res);
2753    return res;
2754  }
2755
2756  protected void parseBundleProperties(JsonObject json, Bundle res) throws IOException, FHIRFormatError {
2757    parseResourceProperties(json, res);
2758    if (json.has("identifier"))
2759      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
2760    if (json.has("type"))
2761      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Bundle.BundleType.NULL, new Bundle.BundleTypeEnumFactory()));
2762    if (json.has("_type"))
2763      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
2764    if (json.has("total"))
2765      res.setTotalElement(parseUnsignedInt(json.get("total").getAsString()));
2766    if (json.has("_total"))
2767      parseElementProperties(getJObject(json, "_total"), res.getTotalElement());
2768    if (json.has("link")) {
2769      JsonArray array = json.getAsJsonArray("link");
2770      for (int i = 0; i < array.size(); i++) {
2771        res.getLink().add(parseBundleBundleLinkComponent(array.get(i).getAsJsonObject(), res));
2772      }
2773    };
2774    if (json.has("entry")) {
2775      JsonArray array = json.getAsJsonArray("entry");
2776      for (int i = 0; i < array.size(); i++) {
2777        res.getEntry().add(parseBundleBundleEntryComponent(array.get(i).getAsJsonObject(), res));
2778      }
2779    };
2780    if (json.has("signature"))
2781      res.setSignature(parseSignature(getJObject(json, "signature")));
2782  }
2783
2784  protected Bundle.BundleLinkComponent parseBundleBundleLinkComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
2785    Bundle.BundleLinkComponent res = new Bundle.BundleLinkComponent();
2786    parseBundleBundleLinkComponentProperties(json, owner, res);
2787    return res;
2788  }
2789
2790  protected void parseBundleBundleLinkComponentProperties(JsonObject json, Bundle owner, Bundle.BundleLinkComponent res) throws IOException, FHIRFormatError {
2791    parseBackboneProperties(json, res);
2792    if (json.has("relation"))
2793      res.setRelationElement(parseString(json.get("relation").getAsString()));
2794    if (json.has("_relation"))
2795      parseElementProperties(getJObject(json, "_relation"), res.getRelationElement());
2796    if (json.has("url"))
2797      res.setUrlElement(parseUri(json.get("url").getAsString()));
2798    if (json.has("_url"))
2799      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
2800  }
2801
2802  protected Bundle.BundleEntryComponent parseBundleBundleEntryComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
2803    Bundle.BundleEntryComponent res = new Bundle.BundleEntryComponent();
2804    parseBundleBundleEntryComponentProperties(json, owner, res);
2805    return res;
2806  }
2807
2808  protected void parseBundleBundleEntryComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntryComponent res) throws IOException, FHIRFormatError {
2809    parseBackboneProperties(json, res);
2810    if (json.has("link")) {
2811      JsonArray array = json.getAsJsonArray("link");
2812      for (int i = 0; i < array.size(); i++) {
2813        res.getLink().add(parseBundleBundleLinkComponent(array.get(i).getAsJsonObject(), owner));
2814      }
2815    };
2816    if (json.has("fullUrl"))
2817      res.setFullUrlElement(parseUri(json.get("fullUrl").getAsString()));
2818    if (json.has("_fullUrl"))
2819      parseElementProperties(getJObject(json, "_fullUrl"), res.getFullUrlElement());
2820    if (json.has("resource"))
2821      res.setResource(parseResource(getJObject(json, "resource")));
2822    if (json.has("search"))
2823      res.setSearch(parseBundleBundleEntrySearchComponent(getJObject(json, "search"), owner));
2824    if (json.has("request"))
2825      res.setRequest(parseBundleBundleEntryRequestComponent(getJObject(json, "request"), owner));
2826    if (json.has("response"))
2827      res.setResponse(parseBundleBundleEntryResponseComponent(getJObject(json, "response"), owner));
2828  }
2829
2830  protected Bundle.BundleEntrySearchComponent parseBundleBundleEntrySearchComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
2831    Bundle.BundleEntrySearchComponent res = new Bundle.BundleEntrySearchComponent();
2832    parseBundleBundleEntrySearchComponentProperties(json, owner, res);
2833    return res;
2834  }
2835
2836  protected void parseBundleBundleEntrySearchComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntrySearchComponent res) throws IOException, FHIRFormatError {
2837    parseBackboneProperties(json, res);
2838    if (json.has("mode"))
2839      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Bundle.SearchEntryMode.NULL, new Bundle.SearchEntryModeEnumFactory()));
2840    if (json.has("_mode"))
2841      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
2842    if (json.has("score"))
2843      res.setScoreElement(parseDecimal(json.get("score").getAsBigDecimal()));
2844    if (json.has("_score"))
2845      parseElementProperties(getJObject(json, "_score"), res.getScoreElement());
2846  }
2847
2848  protected Bundle.BundleEntryRequestComponent parseBundleBundleEntryRequestComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
2849    Bundle.BundleEntryRequestComponent res = new Bundle.BundleEntryRequestComponent();
2850    parseBundleBundleEntryRequestComponentProperties(json, owner, res);
2851    return res;
2852  }
2853
2854  protected void parseBundleBundleEntryRequestComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntryRequestComponent res) throws IOException, FHIRFormatError {
2855    parseBackboneProperties(json, res);
2856    if (json.has("method"))
2857      res.setMethodElement(parseEnumeration(json.get("method").getAsString(), Bundle.HTTPVerb.NULL, new Bundle.HTTPVerbEnumFactory()));
2858    if (json.has("_method"))
2859      parseElementProperties(getJObject(json, "_method"), res.getMethodElement());
2860    if (json.has("url"))
2861      res.setUrlElement(parseUri(json.get("url").getAsString()));
2862    if (json.has("_url"))
2863      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
2864    if (json.has("ifNoneMatch"))
2865      res.setIfNoneMatchElement(parseString(json.get("ifNoneMatch").getAsString()));
2866    if (json.has("_ifNoneMatch"))
2867      parseElementProperties(getJObject(json, "_ifNoneMatch"), res.getIfNoneMatchElement());
2868    if (json.has("ifModifiedSince"))
2869      res.setIfModifiedSinceElement(parseInstant(json.get("ifModifiedSince").getAsString()));
2870    if (json.has("_ifModifiedSince"))
2871      parseElementProperties(getJObject(json, "_ifModifiedSince"), res.getIfModifiedSinceElement());
2872    if (json.has("ifMatch"))
2873      res.setIfMatchElement(parseString(json.get("ifMatch").getAsString()));
2874    if (json.has("_ifMatch"))
2875      parseElementProperties(getJObject(json, "_ifMatch"), res.getIfMatchElement());
2876    if (json.has("ifNoneExist"))
2877      res.setIfNoneExistElement(parseString(json.get("ifNoneExist").getAsString()));
2878    if (json.has("_ifNoneExist"))
2879      parseElementProperties(getJObject(json, "_ifNoneExist"), res.getIfNoneExistElement());
2880  }
2881
2882  protected Bundle.BundleEntryResponseComponent parseBundleBundleEntryResponseComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
2883    Bundle.BundleEntryResponseComponent res = new Bundle.BundleEntryResponseComponent();
2884    parseBundleBundleEntryResponseComponentProperties(json, owner, res);
2885    return res;
2886  }
2887
2888  protected void parseBundleBundleEntryResponseComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntryResponseComponent res) throws IOException, FHIRFormatError {
2889    parseBackboneProperties(json, res);
2890    if (json.has("status"))
2891      res.setStatusElement(parseString(json.get("status").getAsString()));
2892    if (json.has("_status"))
2893      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
2894    if (json.has("location"))
2895      res.setLocationElement(parseUri(json.get("location").getAsString()));
2896    if (json.has("_location"))
2897      parseElementProperties(getJObject(json, "_location"), res.getLocationElement());
2898    if (json.has("etag"))
2899      res.setEtagElement(parseString(json.get("etag").getAsString()));
2900    if (json.has("_etag"))
2901      parseElementProperties(getJObject(json, "_etag"), res.getEtagElement());
2902    if (json.has("lastModified"))
2903      res.setLastModifiedElement(parseInstant(json.get("lastModified").getAsString()));
2904    if (json.has("_lastModified"))
2905      parseElementProperties(getJObject(json, "_lastModified"), res.getLastModifiedElement());
2906    if (json.has("outcome"))
2907      res.setOutcome(parseResource(getJObject(json, "outcome")));
2908  }
2909
2910  protected CapabilityStatement parseCapabilityStatement(JsonObject json) throws IOException, FHIRFormatError {
2911    CapabilityStatement res = new CapabilityStatement();
2912    parseCapabilityStatementProperties(json, res);
2913    return res;
2914  }
2915
2916  protected void parseCapabilityStatementProperties(JsonObject json, CapabilityStatement res) throws IOException, FHIRFormatError {
2917    parseDomainResourceProperties(json, res);
2918    if (json.has("url"))
2919      res.setUrlElement(parseUri(json.get("url").getAsString()));
2920    if (json.has("_url"))
2921      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
2922    if (json.has("version"))
2923      res.setVersionElement(parseString(json.get("version").getAsString()));
2924    if (json.has("_version"))
2925      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
2926    if (json.has("name"))
2927      res.setNameElement(parseString(json.get("name").getAsString()));
2928    if (json.has("_name"))
2929      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
2930    if (json.has("title"))
2931      res.setTitleElement(parseString(json.get("title").getAsString()));
2932    if (json.has("_title"))
2933      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
2934    if (json.has("status"))
2935      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
2936    if (json.has("_status"))
2937      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
2938    if (json.has("experimental"))
2939      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
2940    if (json.has("_experimental"))
2941      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
2942    if (json.has("date"))
2943      res.setDateElement(parseDateTime(json.get("date").getAsString()));
2944    if (json.has("_date"))
2945      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
2946    if (json.has("publisher"))
2947      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
2948    if (json.has("_publisher"))
2949      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
2950    if (json.has("contact")) {
2951      JsonArray array = json.getAsJsonArray("contact");
2952      for (int i = 0; i < array.size(); i++) {
2953        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
2954      }
2955    };
2956    if (json.has("description"))
2957      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
2958    if (json.has("_description"))
2959      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
2960    if (json.has("useContext")) {
2961      JsonArray array = json.getAsJsonArray("useContext");
2962      for (int i = 0; i < array.size(); i++) {
2963        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
2964      }
2965    };
2966    if (json.has("jurisdiction")) {
2967      JsonArray array = json.getAsJsonArray("jurisdiction");
2968      for (int i = 0; i < array.size(); i++) {
2969        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2970      }
2971    };
2972    if (json.has("purpose"))
2973      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
2974    if (json.has("_purpose"))
2975      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
2976    if (json.has("copyright"))
2977      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
2978    if (json.has("_copyright"))
2979      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
2980    if (json.has("kind"))
2981      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), CapabilityStatement.CapabilityStatementKind.NULL, new CapabilityStatement.CapabilityStatementKindEnumFactory()));
2982    if (json.has("_kind"))
2983      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
2984    if (json.has("instantiates")) {
2985      JsonArray array = json.getAsJsonArray("instantiates");
2986      for (int i = 0; i < array.size(); i++) {
2987        if (array.get(i).isJsonNull()) {
2988          res.getInstantiates().add(new UriType());
2989        } else {
2990          res.getInstantiates().add(parseUri(array.get(i).getAsString()));
2991        }
2992      }
2993    };
2994    if (json.has("_instantiates")) {
2995      JsonArray array = json.getAsJsonArray("_instantiates");
2996      for (int i = 0; i < array.size(); i++) {
2997        if (i == res.getInstantiates().size())
2998          res.getInstantiates().add(parseUri(null));
2999        if (array.get(i) instanceof JsonObject) 
3000          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
3001      }
3002    };
3003    if (json.has("software"))
3004      res.setSoftware(parseCapabilityStatementCapabilityStatementSoftwareComponent(getJObject(json, "software"), res));
3005    if (json.has("implementation"))
3006      res.setImplementation(parseCapabilityStatementCapabilityStatementImplementationComponent(getJObject(json, "implementation"), res));
3007    if (json.has("fhirVersion"))
3008      res.setFhirVersionElement(parseId(json.get("fhirVersion").getAsString()));
3009    if (json.has("_fhirVersion"))
3010      parseElementProperties(getJObject(json, "_fhirVersion"), res.getFhirVersionElement());
3011    if (json.has("acceptUnknown"))
3012      res.setAcceptUnknownElement(parseEnumeration(json.get("acceptUnknown").getAsString(), CapabilityStatement.UnknownContentCode.NULL, new CapabilityStatement.UnknownContentCodeEnumFactory()));
3013    if (json.has("_acceptUnknown"))
3014      parseElementProperties(getJObject(json, "_acceptUnknown"), res.getAcceptUnknownElement());
3015    if (json.has("format")) {
3016      JsonArray array = json.getAsJsonArray("format");
3017      for (int i = 0; i < array.size(); i++) {
3018        if (array.get(i).isJsonNull()) {
3019          res.getFormat().add(new CodeType());
3020        } else {
3021          res.getFormat().add(parseCode(array.get(i).getAsString()));
3022        }
3023      }
3024    };
3025    if (json.has("_format")) {
3026      JsonArray array = json.getAsJsonArray("_format");
3027      for (int i = 0; i < array.size(); i++) {
3028        if (i == res.getFormat().size())
3029          res.getFormat().add(parseCode(null));
3030        if (array.get(i) instanceof JsonObject) 
3031          parseElementProperties(array.get(i).getAsJsonObject(), res.getFormat().get(i));
3032      }
3033    };
3034    if (json.has("patchFormat")) {
3035      JsonArray array = json.getAsJsonArray("patchFormat");
3036      for (int i = 0; i < array.size(); i++) {
3037        if (array.get(i).isJsonNull()) {
3038          res.getPatchFormat().add(new CodeType());
3039        } else {
3040          res.getPatchFormat().add(parseCode(array.get(i).getAsString()));
3041        }
3042      }
3043    };
3044    if (json.has("_patchFormat")) {
3045      JsonArray array = json.getAsJsonArray("_patchFormat");
3046      for (int i = 0; i < array.size(); i++) {
3047        if (i == res.getPatchFormat().size())
3048          res.getPatchFormat().add(parseCode(null));
3049        if (array.get(i) instanceof JsonObject) 
3050          parseElementProperties(array.get(i).getAsJsonObject(), res.getPatchFormat().get(i));
3051      }
3052    };
3053    if (json.has("implementationGuide")) {
3054      JsonArray array = json.getAsJsonArray("implementationGuide");
3055      for (int i = 0; i < array.size(); i++) {
3056        if (array.get(i).isJsonNull()) {
3057          res.getImplementationGuide().add(new UriType());
3058        } else {
3059          res.getImplementationGuide().add(parseUri(array.get(i).getAsString()));
3060        }
3061      }
3062    };
3063    if (json.has("_implementationGuide")) {
3064      JsonArray array = json.getAsJsonArray("_implementationGuide");
3065      for (int i = 0; i < array.size(); i++) {
3066        if (i == res.getImplementationGuide().size())
3067          res.getImplementationGuide().add(parseUri(null));
3068        if (array.get(i) instanceof JsonObject) 
3069          parseElementProperties(array.get(i).getAsJsonObject(), res.getImplementationGuide().get(i));
3070      }
3071    };
3072    if (json.has("profile")) {
3073      JsonArray array = json.getAsJsonArray("profile");
3074      for (int i = 0; i < array.size(); i++) {
3075        res.getProfile().add(parseReference(array.get(i).getAsJsonObject()));
3076      }
3077    };
3078    if (json.has("rest")) {
3079      JsonArray array = json.getAsJsonArray("rest");
3080      for (int i = 0; i < array.size(); i++) {
3081        res.getRest().add(parseCapabilityStatementCapabilityStatementRestComponent(array.get(i).getAsJsonObject(), res));
3082      }
3083    };
3084    if (json.has("messaging")) {
3085      JsonArray array = json.getAsJsonArray("messaging");
3086      for (int i = 0; i < array.size(); i++) {
3087        res.getMessaging().add(parseCapabilityStatementCapabilityStatementMessagingComponent(array.get(i).getAsJsonObject(), res));
3088      }
3089    };
3090    if (json.has("document")) {
3091      JsonArray array = json.getAsJsonArray("document");
3092      for (int i = 0; i < array.size(); i++) {
3093        res.getDocument().add(parseCapabilityStatementCapabilityStatementDocumentComponent(array.get(i).getAsJsonObject(), res));
3094      }
3095    };
3096  }
3097
3098  protected CapabilityStatement.CapabilityStatementSoftwareComponent parseCapabilityStatementCapabilityStatementSoftwareComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3099    CapabilityStatement.CapabilityStatementSoftwareComponent res = new CapabilityStatement.CapabilityStatementSoftwareComponent();
3100    parseCapabilityStatementCapabilityStatementSoftwareComponentProperties(json, owner, res);
3101    return res;
3102  }
3103
3104  protected void parseCapabilityStatementCapabilityStatementSoftwareComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementSoftwareComponent res) throws IOException, FHIRFormatError {
3105    parseBackboneProperties(json, res);
3106    if (json.has("name"))
3107      res.setNameElement(parseString(json.get("name").getAsString()));
3108    if (json.has("_name"))
3109      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
3110    if (json.has("version"))
3111      res.setVersionElement(parseString(json.get("version").getAsString()));
3112    if (json.has("_version"))
3113      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
3114    if (json.has("releaseDate"))
3115      res.setReleaseDateElement(parseDateTime(json.get("releaseDate").getAsString()));
3116    if (json.has("_releaseDate"))
3117      parseElementProperties(getJObject(json, "_releaseDate"), res.getReleaseDateElement());
3118  }
3119
3120  protected CapabilityStatement.CapabilityStatementImplementationComponent parseCapabilityStatementCapabilityStatementImplementationComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3121    CapabilityStatement.CapabilityStatementImplementationComponent res = new CapabilityStatement.CapabilityStatementImplementationComponent();
3122    parseCapabilityStatementCapabilityStatementImplementationComponentProperties(json, owner, res);
3123    return res;
3124  }
3125
3126  protected void parseCapabilityStatementCapabilityStatementImplementationComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementImplementationComponent res) throws IOException, FHIRFormatError {
3127    parseBackboneProperties(json, res);
3128    if (json.has("description"))
3129      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3130    if (json.has("_description"))
3131      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3132    if (json.has("url"))
3133      res.setUrlElement(parseUri(json.get("url").getAsString()));
3134    if (json.has("_url"))
3135      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
3136  }
3137
3138  protected CapabilityStatement.CapabilityStatementRestComponent parseCapabilityStatementCapabilityStatementRestComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3139    CapabilityStatement.CapabilityStatementRestComponent res = new CapabilityStatement.CapabilityStatementRestComponent();
3140    parseCapabilityStatementCapabilityStatementRestComponentProperties(json, owner, res);
3141    return res;
3142  }
3143
3144  protected void parseCapabilityStatementCapabilityStatementRestComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestComponent res) throws IOException, FHIRFormatError {
3145    parseBackboneProperties(json, res);
3146    if (json.has("mode"))
3147      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.RestfulCapabilityMode.NULL, new CapabilityStatement.RestfulCapabilityModeEnumFactory()));
3148    if (json.has("_mode"))
3149      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
3150    if (json.has("documentation"))
3151      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3152    if (json.has("_documentation"))
3153      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
3154    if (json.has("security"))
3155      res.setSecurity(parseCapabilityStatementCapabilityStatementRestSecurityComponent(getJObject(json, "security"), owner));
3156    if (json.has("resource")) {
3157      JsonArray array = json.getAsJsonArray("resource");
3158      for (int i = 0; i < array.size(); i++) {
3159        res.getResource().add(parseCapabilityStatementCapabilityStatementRestResourceComponent(array.get(i).getAsJsonObject(), owner));
3160      }
3161    };
3162    if (json.has("interaction")) {
3163      JsonArray array = json.getAsJsonArray("interaction");
3164      for (int i = 0; i < array.size(); i++) {
3165        res.getInteraction().add(parseCapabilityStatementSystemInteractionComponent(array.get(i).getAsJsonObject(), owner));
3166      }
3167    };
3168    if (json.has("searchParam")) {
3169      JsonArray array = json.getAsJsonArray("searchParam");
3170      for (int i = 0; i < array.size(); i++) {
3171        res.getSearchParam().add(parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(array.get(i).getAsJsonObject(), owner));
3172      }
3173    };
3174    if (json.has("operation")) {
3175      JsonArray array = json.getAsJsonArray("operation");
3176      for (int i = 0; i < array.size(); i++) {
3177        res.getOperation().add(parseCapabilityStatementCapabilityStatementRestOperationComponent(array.get(i).getAsJsonObject(), owner));
3178      }
3179    };
3180    if (json.has("compartment")) {
3181      JsonArray array = json.getAsJsonArray("compartment");
3182      for (int i = 0; i < array.size(); i++) {
3183        if (array.get(i).isJsonNull()) {
3184          res.getCompartment().add(new UriType());
3185        } else {
3186          res.getCompartment().add(parseUri(array.get(i).getAsString()));
3187        }
3188      }
3189    };
3190    if (json.has("_compartment")) {
3191      JsonArray array = json.getAsJsonArray("_compartment");
3192      for (int i = 0; i < array.size(); i++) {
3193        if (i == res.getCompartment().size())
3194          res.getCompartment().add(parseUri(null));
3195        if (array.get(i) instanceof JsonObject) 
3196          parseElementProperties(array.get(i).getAsJsonObject(), res.getCompartment().get(i));
3197      }
3198    };
3199  }
3200
3201  protected CapabilityStatement.CapabilityStatementRestSecurityComponent parseCapabilityStatementCapabilityStatementRestSecurityComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3202    CapabilityStatement.CapabilityStatementRestSecurityComponent res = new CapabilityStatement.CapabilityStatementRestSecurityComponent();
3203    parseCapabilityStatementCapabilityStatementRestSecurityComponentProperties(json, owner, res);
3204    return res;
3205  }
3206
3207  protected void parseCapabilityStatementCapabilityStatementRestSecurityComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestSecurityComponent res) throws IOException, FHIRFormatError {
3208    parseBackboneProperties(json, res);
3209    if (json.has("cors"))
3210      res.setCorsElement(parseBoolean(json.get("cors").getAsBoolean()));
3211    if (json.has("_cors"))
3212      parseElementProperties(getJObject(json, "_cors"), res.getCorsElement());
3213    if (json.has("service")) {
3214      JsonArray array = json.getAsJsonArray("service");
3215      for (int i = 0; i < array.size(); i++) {
3216        res.getService().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3217      }
3218    };
3219    if (json.has("description"))
3220      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3221    if (json.has("_description"))
3222      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3223    if (json.has("certificate")) {
3224      JsonArray array = json.getAsJsonArray("certificate");
3225      for (int i = 0; i < array.size(); i++) {
3226        res.getCertificate().add(parseCapabilityStatementCapabilityStatementRestSecurityCertificateComponent(array.get(i).getAsJsonObject(), owner));
3227      }
3228    };
3229  }
3230
3231  protected CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent parseCapabilityStatementCapabilityStatementRestSecurityCertificateComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3232    CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent res = new CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent();
3233    parseCapabilityStatementCapabilityStatementRestSecurityCertificateComponentProperties(json, owner, res);
3234    return res;
3235  }
3236
3237  protected void parseCapabilityStatementCapabilityStatementRestSecurityCertificateComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent res) throws IOException, FHIRFormatError {
3238    parseBackboneProperties(json, res);
3239    if (json.has("type"))
3240      res.setTypeElement(parseCode(json.get("type").getAsString()));
3241    if (json.has("_type"))
3242      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
3243    if (json.has("blob"))
3244      res.setBlobElement(parseBase64Binary(json.get("blob").getAsString()));
3245    if (json.has("_blob"))
3246      parseElementProperties(getJObject(json, "_blob"), res.getBlobElement());
3247  }
3248
3249  protected CapabilityStatement.CapabilityStatementRestResourceComponent parseCapabilityStatementCapabilityStatementRestResourceComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3250    CapabilityStatement.CapabilityStatementRestResourceComponent res = new CapabilityStatement.CapabilityStatementRestResourceComponent();
3251    parseCapabilityStatementCapabilityStatementRestResourceComponentProperties(json, owner, res);
3252    return res;
3253  }
3254
3255  protected void parseCapabilityStatementCapabilityStatementRestResourceComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestResourceComponent res) throws IOException, FHIRFormatError {
3256    parseBackboneProperties(json, res);
3257    if (json.has("type"))
3258      res.setTypeElement(parseCode(json.get("type").getAsString()));
3259    if (json.has("_type"))
3260      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
3261    if (json.has("profile"))
3262      res.setProfile(parseReference(getJObject(json, "profile")));
3263    if (json.has("documentation"))
3264      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3265    if (json.has("_documentation"))
3266      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
3267    if (json.has("interaction")) {
3268      JsonArray array = json.getAsJsonArray("interaction");
3269      for (int i = 0; i < array.size(); i++) {
3270        res.getInteraction().add(parseCapabilityStatementResourceInteractionComponent(array.get(i).getAsJsonObject(), owner));
3271      }
3272    };
3273    if (json.has("versioning"))
3274      res.setVersioningElement(parseEnumeration(json.get("versioning").getAsString(), CapabilityStatement.ResourceVersionPolicy.NULL, new CapabilityStatement.ResourceVersionPolicyEnumFactory()));
3275    if (json.has("_versioning"))
3276      parseElementProperties(getJObject(json, "_versioning"), res.getVersioningElement());
3277    if (json.has("readHistory"))
3278      res.setReadHistoryElement(parseBoolean(json.get("readHistory").getAsBoolean()));
3279    if (json.has("_readHistory"))
3280      parseElementProperties(getJObject(json, "_readHistory"), res.getReadHistoryElement());
3281    if (json.has("updateCreate"))
3282      res.setUpdateCreateElement(parseBoolean(json.get("updateCreate").getAsBoolean()));
3283    if (json.has("_updateCreate"))
3284      parseElementProperties(getJObject(json, "_updateCreate"), res.getUpdateCreateElement());
3285    if (json.has("conditionalCreate"))
3286      res.setConditionalCreateElement(parseBoolean(json.get("conditionalCreate").getAsBoolean()));
3287    if (json.has("_conditionalCreate"))
3288      parseElementProperties(getJObject(json, "_conditionalCreate"), res.getConditionalCreateElement());
3289    if (json.has("conditionalRead"))
3290      res.setConditionalReadElement(parseEnumeration(json.get("conditionalRead").getAsString(), CapabilityStatement.ConditionalReadStatus.NULL, new CapabilityStatement.ConditionalReadStatusEnumFactory()));
3291    if (json.has("_conditionalRead"))
3292      parseElementProperties(getJObject(json, "_conditionalRead"), res.getConditionalReadElement());
3293    if (json.has("conditionalUpdate"))
3294      res.setConditionalUpdateElement(parseBoolean(json.get("conditionalUpdate").getAsBoolean()));
3295    if (json.has("_conditionalUpdate"))
3296      parseElementProperties(getJObject(json, "_conditionalUpdate"), res.getConditionalUpdateElement());
3297    if (json.has("conditionalDelete"))
3298      res.setConditionalDeleteElement(parseEnumeration(json.get("conditionalDelete").getAsString(), CapabilityStatement.ConditionalDeleteStatus.NULL, new CapabilityStatement.ConditionalDeleteStatusEnumFactory()));
3299    if (json.has("_conditionalDelete"))
3300      parseElementProperties(getJObject(json, "_conditionalDelete"), res.getConditionalDeleteElement());
3301    if (json.has("referencePolicy")) {
3302      JsonArray array = json.getAsJsonArray("referencePolicy");
3303      for (int i = 0; i < array.size(); i++) {
3304        if (array.get(i).isJsonNull()) {
3305          res.getReferencePolicy().add(new Enumeration<CapabilityStatement.ReferenceHandlingPolicy>());
3306        } else {
3307          res.getReferencePolicy().add(parseEnumeration(array.get(i).getAsString(), CapabilityStatement.ReferenceHandlingPolicy.NULL, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory()));
3308        }
3309      }
3310    };
3311    if (json.has("_referencePolicy")) {
3312      JsonArray array = json.getAsJsonArray("_referencePolicy");
3313      for (int i = 0; i < array.size(); i++) {
3314        if (i == res.getReferencePolicy().size())
3315          res.getReferencePolicy().add(parseEnumeration(null, CapabilityStatement.ReferenceHandlingPolicy.NULL, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory()));
3316        if (array.get(i) instanceof JsonObject) 
3317          parseElementProperties(array.get(i).getAsJsonObject(), res.getReferencePolicy().get(i));
3318      }
3319    };
3320    if (json.has("searchInclude")) {
3321      JsonArray array = json.getAsJsonArray("searchInclude");
3322      for (int i = 0; i < array.size(); i++) {
3323        if (array.get(i).isJsonNull()) {
3324          res.getSearchInclude().add(new StringType());
3325        } else {
3326          res.getSearchInclude().add(parseString(array.get(i).getAsString()));
3327        }
3328      }
3329    };
3330    if (json.has("_searchInclude")) {
3331      JsonArray array = json.getAsJsonArray("_searchInclude");
3332      for (int i = 0; i < array.size(); i++) {
3333        if (i == res.getSearchInclude().size())
3334          res.getSearchInclude().add(parseString(null));
3335        if (array.get(i) instanceof JsonObject) 
3336          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchInclude().get(i));
3337      }
3338    };
3339    if (json.has("searchRevInclude")) {
3340      JsonArray array = json.getAsJsonArray("searchRevInclude");
3341      for (int i = 0; i < array.size(); i++) {
3342        if (array.get(i).isJsonNull()) {
3343          res.getSearchRevInclude().add(new StringType());
3344        } else {
3345          res.getSearchRevInclude().add(parseString(array.get(i).getAsString()));
3346        }
3347      }
3348    };
3349    if (json.has("_searchRevInclude")) {
3350      JsonArray array = json.getAsJsonArray("_searchRevInclude");
3351      for (int i = 0; i < array.size(); i++) {
3352        if (i == res.getSearchRevInclude().size())
3353          res.getSearchRevInclude().add(parseString(null));
3354        if (array.get(i) instanceof JsonObject) 
3355          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchRevInclude().get(i));
3356      }
3357    };
3358    if (json.has("searchParam")) {
3359      JsonArray array = json.getAsJsonArray("searchParam");
3360      for (int i = 0; i < array.size(); i++) {
3361        res.getSearchParam().add(parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(array.get(i).getAsJsonObject(), owner));
3362      }
3363    };
3364  }
3365
3366  protected CapabilityStatement.ResourceInteractionComponent parseCapabilityStatementResourceInteractionComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3367    CapabilityStatement.ResourceInteractionComponent res = new CapabilityStatement.ResourceInteractionComponent();
3368    parseCapabilityStatementResourceInteractionComponentProperties(json, owner, res);
3369    return res;
3370  }
3371
3372  protected void parseCapabilityStatementResourceInteractionComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.ResourceInteractionComponent res) throws IOException, FHIRFormatError {
3373    parseBackboneProperties(json, res);
3374    if (json.has("code"))
3375      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement.TypeRestfulInteraction.NULL, new CapabilityStatement.TypeRestfulInteractionEnumFactory()));
3376    if (json.has("_code"))
3377      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
3378    if (json.has("documentation"))
3379      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3380    if (json.has("_documentation"))
3381      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
3382  }
3383
3384  protected CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3385    CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res = new CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent();
3386    parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponentProperties(json, owner, res);
3387    return res;
3388  }
3389
3390  protected void parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res) throws IOException, FHIRFormatError {
3391    parseBackboneProperties(json, res);
3392    if (json.has("name"))
3393      res.setNameElement(parseString(json.get("name").getAsString()));
3394    if (json.has("_name"))
3395      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
3396    if (json.has("definition"))
3397      res.setDefinitionElement(parseUri(json.get("definition").getAsString()));
3398    if (json.has("_definition"))
3399      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
3400    if (json.has("type"))
3401      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
3402    if (json.has("_type"))
3403      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
3404    if (json.has("documentation"))
3405      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3406    if (json.has("_documentation"))
3407      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
3408  }
3409
3410  protected CapabilityStatement.SystemInteractionComponent parseCapabilityStatementSystemInteractionComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3411    CapabilityStatement.SystemInteractionComponent res = new CapabilityStatement.SystemInteractionComponent();
3412    parseCapabilityStatementSystemInteractionComponentProperties(json, owner, res);
3413    return res;
3414  }
3415
3416  protected void parseCapabilityStatementSystemInteractionComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.SystemInteractionComponent res) throws IOException, FHIRFormatError {
3417    parseBackboneProperties(json, res);
3418    if (json.has("code"))
3419      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement.SystemRestfulInteraction.NULL, new CapabilityStatement.SystemRestfulInteractionEnumFactory()));
3420    if (json.has("_code"))
3421      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
3422    if (json.has("documentation"))
3423      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3424    if (json.has("_documentation"))
3425      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
3426  }
3427
3428  protected CapabilityStatement.CapabilityStatementRestOperationComponent parseCapabilityStatementCapabilityStatementRestOperationComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3429    CapabilityStatement.CapabilityStatementRestOperationComponent res = new CapabilityStatement.CapabilityStatementRestOperationComponent();
3430    parseCapabilityStatementCapabilityStatementRestOperationComponentProperties(json, owner, res);
3431    return res;
3432  }
3433
3434  protected void parseCapabilityStatementCapabilityStatementRestOperationComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestOperationComponent res) throws IOException, FHIRFormatError {
3435    parseBackboneProperties(json, res);
3436    if (json.has("name"))
3437      res.setNameElement(parseString(json.get("name").getAsString()));
3438    if (json.has("_name"))
3439      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
3440    if (json.has("definition"))
3441      res.setDefinition(parseReference(getJObject(json, "definition")));
3442  }
3443
3444  protected CapabilityStatement.CapabilityStatementMessagingComponent parseCapabilityStatementCapabilityStatementMessagingComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3445    CapabilityStatement.CapabilityStatementMessagingComponent res = new CapabilityStatement.CapabilityStatementMessagingComponent();
3446    parseCapabilityStatementCapabilityStatementMessagingComponentProperties(json, owner, res);
3447    return res;
3448  }
3449
3450  protected void parseCapabilityStatementCapabilityStatementMessagingComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingComponent res) throws IOException, FHIRFormatError {
3451    parseBackboneProperties(json, res);
3452    if (json.has("endpoint")) {
3453      JsonArray array = json.getAsJsonArray("endpoint");
3454      for (int i = 0; i < array.size(); i++) {
3455        res.getEndpoint().add(parseCapabilityStatementCapabilityStatementMessagingEndpointComponent(array.get(i).getAsJsonObject(), owner));
3456      }
3457    };
3458    if (json.has("reliableCache"))
3459      res.setReliableCacheElement(parseUnsignedInt(json.get("reliableCache").getAsString()));
3460    if (json.has("_reliableCache"))
3461      parseElementProperties(getJObject(json, "_reliableCache"), res.getReliableCacheElement());
3462    if (json.has("documentation"))
3463      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3464    if (json.has("_documentation"))
3465      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
3466    if (json.has("supportedMessage")) {
3467      JsonArray array = json.getAsJsonArray("supportedMessage");
3468      for (int i = 0; i < array.size(); i++) {
3469        res.getSupportedMessage().add(parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(array.get(i).getAsJsonObject(), owner));
3470      }
3471    };
3472    if (json.has("event")) {
3473      JsonArray array = json.getAsJsonArray("event");
3474      for (int i = 0; i < array.size(); i++) {
3475        res.getEvent().add(parseCapabilityStatementCapabilityStatementMessagingEventComponent(array.get(i).getAsJsonObject(), owner));
3476      }
3477    };
3478  }
3479
3480  protected CapabilityStatement.CapabilityStatementMessagingEndpointComponent parseCapabilityStatementCapabilityStatementMessagingEndpointComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3481    CapabilityStatement.CapabilityStatementMessagingEndpointComponent res = new CapabilityStatement.CapabilityStatementMessagingEndpointComponent();
3482    parseCapabilityStatementCapabilityStatementMessagingEndpointComponentProperties(json, owner, res);
3483    return res;
3484  }
3485
3486  protected void parseCapabilityStatementCapabilityStatementMessagingEndpointComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingEndpointComponent res) throws IOException, FHIRFormatError {
3487    parseBackboneProperties(json, res);
3488    if (json.has("protocol"))
3489      res.setProtocol(parseCoding(getJObject(json, "protocol")));
3490    if (json.has("address"))
3491      res.setAddressElement(parseUri(json.get("address").getAsString()));
3492    if (json.has("_address"))
3493      parseElementProperties(getJObject(json, "_address"), res.getAddressElement());
3494  }
3495
3496  protected CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3497    CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res = new CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent();
3498    parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentProperties(json, owner, res);
3499    return res;
3500  }
3501
3502  protected void parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res) throws IOException, FHIRFormatError {
3503    parseBackboneProperties(json, res);
3504    if (json.has("mode"))
3505      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.EventCapabilityMode.NULL, new CapabilityStatement.EventCapabilityModeEnumFactory()));
3506    if (json.has("_mode"))
3507      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
3508    if (json.has("definition"))
3509      res.setDefinition(parseReference(getJObject(json, "definition")));
3510  }
3511
3512  protected CapabilityStatement.CapabilityStatementMessagingEventComponent parseCapabilityStatementCapabilityStatementMessagingEventComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3513    CapabilityStatement.CapabilityStatementMessagingEventComponent res = new CapabilityStatement.CapabilityStatementMessagingEventComponent();
3514    parseCapabilityStatementCapabilityStatementMessagingEventComponentProperties(json, owner, res);
3515    return res;
3516  }
3517
3518  protected void parseCapabilityStatementCapabilityStatementMessagingEventComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingEventComponent res) throws IOException, FHIRFormatError {
3519    parseBackboneProperties(json, res);
3520    if (json.has("code"))
3521      res.setCode(parseCoding(getJObject(json, "code")));
3522    if (json.has("category"))
3523      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), CapabilityStatement.MessageSignificanceCategory.NULL, new CapabilityStatement.MessageSignificanceCategoryEnumFactory()));
3524    if (json.has("_category"))
3525      parseElementProperties(getJObject(json, "_category"), res.getCategoryElement());
3526    if (json.has("mode"))
3527      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.EventCapabilityMode.NULL, new CapabilityStatement.EventCapabilityModeEnumFactory()));
3528    if (json.has("_mode"))
3529      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
3530    if (json.has("focus"))
3531      res.setFocusElement(parseCode(json.get("focus").getAsString()));
3532    if (json.has("_focus"))
3533      parseElementProperties(getJObject(json, "_focus"), res.getFocusElement());
3534    if (json.has("request"))
3535      res.setRequest(parseReference(getJObject(json, "request")));
3536    if (json.has("response"))
3537      res.setResponse(parseReference(getJObject(json, "response")));
3538    if (json.has("documentation"))
3539      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3540    if (json.has("_documentation"))
3541      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
3542  }
3543
3544  protected CapabilityStatement.CapabilityStatementDocumentComponent parseCapabilityStatementCapabilityStatementDocumentComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3545    CapabilityStatement.CapabilityStatementDocumentComponent res = new CapabilityStatement.CapabilityStatementDocumentComponent();
3546    parseCapabilityStatementCapabilityStatementDocumentComponentProperties(json, owner, res);
3547    return res;
3548  }
3549
3550  protected void parseCapabilityStatementCapabilityStatementDocumentComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementDocumentComponent res) throws IOException, FHIRFormatError {
3551    parseBackboneProperties(json, res);
3552    if (json.has("mode"))
3553      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.DocumentMode.NULL, new CapabilityStatement.DocumentModeEnumFactory()));
3554    if (json.has("_mode"))
3555      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
3556    if (json.has("documentation"))
3557      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3558    if (json.has("_documentation"))
3559      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
3560    if (json.has("profile"))
3561      res.setProfile(parseReference(getJObject(json, "profile")));
3562  }
3563
3564  protected CarePlan parseCarePlan(JsonObject json) throws IOException, FHIRFormatError {
3565    CarePlan res = new CarePlan();
3566    parseCarePlanProperties(json, res);
3567    return res;
3568  }
3569
3570  protected void parseCarePlanProperties(JsonObject json, CarePlan res) throws IOException, FHIRFormatError {
3571    parseDomainResourceProperties(json, res);
3572    if (json.has("identifier")) {
3573      JsonArray array = json.getAsJsonArray("identifier");
3574      for (int i = 0; i < array.size(); i++) {
3575        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3576      }
3577    };
3578    if (json.has("definition")) {
3579      JsonArray array = json.getAsJsonArray("definition");
3580      for (int i = 0; i < array.size(); i++) {
3581        res.getDefinition().add(parseReference(array.get(i).getAsJsonObject()));
3582      }
3583    };
3584    if (json.has("basedOn")) {
3585      JsonArray array = json.getAsJsonArray("basedOn");
3586      for (int i = 0; i < array.size(); i++) {
3587        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
3588      }
3589    };
3590    if (json.has("replaces")) {
3591      JsonArray array = json.getAsJsonArray("replaces");
3592      for (int i = 0; i < array.size(); i++) {
3593        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
3594      }
3595    };
3596    if (json.has("partOf")) {
3597      JsonArray array = json.getAsJsonArray("partOf");
3598      for (int i = 0; i < array.size(); i++) {
3599        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
3600      }
3601    };
3602    if (json.has("status"))
3603      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CarePlan.CarePlanStatus.NULL, new CarePlan.CarePlanStatusEnumFactory()));
3604    if (json.has("_status"))
3605      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
3606    if (json.has("intent"))
3607      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), CarePlan.CarePlanIntent.NULL, new CarePlan.CarePlanIntentEnumFactory()));
3608    if (json.has("_intent"))
3609      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
3610    if (json.has("category")) {
3611      JsonArray array = json.getAsJsonArray("category");
3612      for (int i = 0; i < array.size(); i++) {
3613        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3614      }
3615    };
3616    if (json.has("title"))
3617      res.setTitleElement(parseString(json.get("title").getAsString()));
3618    if (json.has("_title"))
3619      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
3620    if (json.has("description"))
3621      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3622    if (json.has("_description"))
3623      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3624    if (json.has("subject"))
3625      res.setSubject(parseReference(getJObject(json, "subject")));
3626    if (json.has("context"))
3627      res.setContext(parseReference(getJObject(json, "context")));
3628    if (json.has("period"))
3629      res.setPeriod(parsePeriod(getJObject(json, "period")));
3630    if (json.has("author")) {
3631      JsonArray array = json.getAsJsonArray("author");
3632      for (int i = 0; i < array.size(); i++) {
3633        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
3634      }
3635    };
3636    if (json.has("careTeam")) {
3637      JsonArray array = json.getAsJsonArray("careTeam");
3638      for (int i = 0; i < array.size(); i++) {
3639        res.getCareTeam().add(parseReference(array.get(i).getAsJsonObject()));
3640      }
3641    };
3642    if (json.has("addresses")) {
3643      JsonArray array = json.getAsJsonArray("addresses");
3644      for (int i = 0; i < array.size(); i++) {
3645        res.getAddresses().add(parseReference(array.get(i).getAsJsonObject()));
3646      }
3647    };
3648    if (json.has("supportingInfo")) {
3649      JsonArray array = json.getAsJsonArray("supportingInfo");
3650      for (int i = 0; i < array.size(); i++) {
3651        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
3652      }
3653    };
3654    if (json.has("goal")) {
3655      JsonArray array = json.getAsJsonArray("goal");
3656      for (int i = 0; i < array.size(); i++) {
3657        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
3658      }
3659    };
3660    if (json.has("activity")) {
3661      JsonArray array = json.getAsJsonArray("activity");
3662      for (int i = 0; i < array.size(); i++) {
3663        res.getActivity().add(parseCarePlanCarePlanActivityComponent(array.get(i).getAsJsonObject(), res));
3664      }
3665    };
3666    if (json.has("note")) {
3667      JsonArray array = json.getAsJsonArray("note");
3668      for (int i = 0; i < array.size(); i++) {
3669        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
3670      }
3671    };
3672  }
3673
3674  protected CarePlan.CarePlanActivityComponent parseCarePlanCarePlanActivityComponent(JsonObject json, CarePlan owner) throws IOException, FHIRFormatError {
3675    CarePlan.CarePlanActivityComponent res = new CarePlan.CarePlanActivityComponent();
3676    parseCarePlanCarePlanActivityComponentProperties(json, owner, res);
3677    return res;
3678  }
3679
3680  protected void parseCarePlanCarePlanActivityComponentProperties(JsonObject json, CarePlan owner, CarePlan.CarePlanActivityComponent res) throws IOException, FHIRFormatError {
3681    parseBackboneProperties(json, res);
3682    if (json.has("outcomeCodeableConcept")) {
3683      JsonArray array = json.getAsJsonArray("outcomeCodeableConcept");
3684      for (int i = 0; i < array.size(); i++) {
3685        res.getOutcomeCodeableConcept().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3686      }
3687    };
3688    if (json.has("outcomeReference")) {
3689      JsonArray array = json.getAsJsonArray("outcomeReference");
3690      for (int i = 0; i < array.size(); i++) {
3691        res.getOutcomeReference().add(parseReference(array.get(i).getAsJsonObject()));
3692      }
3693    };
3694    if (json.has("progress")) {
3695      JsonArray array = json.getAsJsonArray("progress");
3696      for (int i = 0; i < array.size(); i++) {
3697        res.getProgress().add(parseAnnotation(array.get(i).getAsJsonObject()));
3698      }
3699    };
3700    if (json.has("reference"))
3701      res.setReference(parseReference(getJObject(json, "reference")));
3702    if (json.has("detail"))
3703      res.setDetail(parseCarePlanCarePlanActivityDetailComponent(getJObject(json, "detail"), owner));
3704  }
3705
3706  protected CarePlan.CarePlanActivityDetailComponent parseCarePlanCarePlanActivityDetailComponent(JsonObject json, CarePlan owner) throws IOException, FHIRFormatError {
3707    CarePlan.CarePlanActivityDetailComponent res = new CarePlan.CarePlanActivityDetailComponent();
3708    parseCarePlanCarePlanActivityDetailComponentProperties(json, owner, res);
3709    return res;
3710  }
3711
3712  protected void parseCarePlanCarePlanActivityDetailComponentProperties(JsonObject json, CarePlan owner, CarePlan.CarePlanActivityDetailComponent res) throws IOException, FHIRFormatError {
3713    parseBackboneProperties(json, res);
3714    if (json.has("category"))
3715      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
3716    if (json.has("definition"))
3717      res.setDefinition(parseReference(getJObject(json, "definition")));
3718    if (json.has("code"))
3719      res.setCode(parseCodeableConcept(getJObject(json, "code")));
3720    if (json.has("reasonCode")) {
3721      JsonArray array = json.getAsJsonArray("reasonCode");
3722      for (int i = 0; i < array.size(); i++) {
3723        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3724      }
3725    };
3726    if (json.has("reasonReference")) {
3727      JsonArray array = json.getAsJsonArray("reasonReference");
3728      for (int i = 0; i < array.size(); i++) {
3729        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
3730      }
3731    };
3732    if (json.has("goal")) {
3733      JsonArray array = json.getAsJsonArray("goal");
3734      for (int i = 0; i < array.size(); i++) {
3735        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
3736      }
3737    };
3738    if (json.has("status"))
3739      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CarePlan.CarePlanActivityStatus.NULL, new CarePlan.CarePlanActivityStatusEnumFactory()));
3740    if (json.has("_status"))
3741      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
3742    if (json.has("statusReason"))
3743      res.setStatusReasonElement(parseString(json.get("statusReason").getAsString()));
3744    if (json.has("_statusReason"))
3745      parseElementProperties(getJObject(json, "_statusReason"), res.getStatusReasonElement());
3746    if (json.has("prohibited"))
3747      res.setProhibitedElement(parseBoolean(json.get("prohibited").getAsBoolean()));
3748    if (json.has("_prohibited"))
3749      parseElementProperties(getJObject(json, "_prohibited"), res.getProhibitedElement());
3750    Type scheduled = parseType("scheduled", json);
3751    if (scheduled != null)
3752      res.setScheduled(scheduled);
3753    if (json.has("location"))
3754      res.setLocation(parseReference(getJObject(json, "location")));
3755    if (json.has("performer")) {
3756      JsonArray array = json.getAsJsonArray("performer");
3757      for (int i = 0; i < array.size(); i++) {
3758        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
3759      }
3760    };
3761    Type product = parseType("product", json);
3762    if (product != null)
3763      res.setProduct(product);
3764    if (json.has("dailyAmount"))
3765      res.setDailyAmount(parseSimpleQuantity(getJObject(json, "dailyAmount")));
3766    if (json.has("quantity"))
3767      res.setQuantity(parseSimpleQuantity(getJObject(json, "quantity")));
3768    if (json.has("description"))
3769      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3770    if (json.has("_description"))
3771      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
3772  }
3773
3774  protected CareTeam parseCareTeam(JsonObject json) throws IOException, FHIRFormatError {
3775    CareTeam res = new CareTeam();
3776    parseCareTeamProperties(json, res);
3777    return res;
3778  }
3779
3780  protected void parseCareTeamProperties(JsonObject json, CareTeam res) throws IOException, FHIRFormatError {
3781    parseDomainResourceProperties(json, res);
3782    if (json.has("identifier")) {
3783      JsonArray array = json.getAsJsonArray("identifier");
3784      for (int i = 0; i < array.size(); i++) {
3785        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3786      }
3787    };
3788    if (json.has("status"))
3789      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CareTeam.CareTeamStatus.NULL, new CareTeam.CareTeamStatusEnumFactory()));
3790    if (json.has("_status"))
3791      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
3792    if (json.has("category")) {
3793      JsonArray array = json.getAsJsonArray("category");
3794      for (int i = 0; i < array.size(); i++) {
3795        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3796      }
3797    };
3798    if (json.has("name"))
3799      res.setNameElement(parseString(json.get("name").getAsString()));
3800    if (json.has("_name"))
3801      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
3802    if (json.has("subject"))
3803      res.setSubject(parseReference(getJObject(json, "subject")));
3804    if (json.has("context"))
3805      res.setContext(parseReference(getJObject(json, "context")));
3806    if (json.has("period"))
3807      res.setPeriod(parsePeriod(getJObject(json, "period")));
3808    if (json.has("participant")) {
3809      JsonArray array = json.getAsJsonArray("participant");
3810      for (int i = 0; i < array.size(); i++) {
3811        res.getParticipant().add(parseCareTeamCareTeamParticipantComponent(array.get(i).getAsJsonObject(), res));
3812      }
3813    };
3814    if (json.has("reasonCode")) {
3815      JsonArray array = json.getAsJsonArray("reasonCode");
3816      for (int i = 0; i < array.size(); i++) {
3817        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3818      }
3819    };
3820    if (json.has("reasonReference")) {
3821      JsonArray array = json.getAsJsonArray("reasonReference");
3822      for (int i = 0; i < array.size(); i++) {
3823        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
3824      }
3825    };
3826    if (json.has("managingOrganization")) {
3827      JsonArray array = json.getAsJsonArray("managingOrganization");
3828      for (int i = 0; i < array.size(); i++) {
3829        res.getManagingOrganization().add(parseReference(array.get(i).getAsJsonObject()));
3830      }
3831    };
3832    if (json.has("note")) {
3833      JsonArray array = json.getAsJsonArray("note");
3834      for (int i = 0; i < array.size(); i++) {
3835        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
3836      }
3837    };
3838  }
3839
3840  protected CareTeam.CareTeamParticipantComponent parseCareTeamCareTeamParticipantComponent(JsonObject json, CareTeam owner) throws IOException, FHIRFormatError {
3841    CareTeam.CareTeamParticipantComponent res = new CareTeam.CareTeamParticipantComponent();
3842    parseCareTeamCareTeamParticipantComponentProperties(json, owner, res);
3843    return res;
3844  }
3845
3846  protected void parseCareTeamCareTeamParticipantComponentProperties(JsonObject json, CareTeam owner, CareTeam.CareTeamParticipantComponent res) throws IOException, FHIRFormatError {
3847    parseBackboneProperties(json, res);
3848    if (json.has("role"))
3849      res.setRole(parseCodeableConcept(getJObject(json, "role")));
3850    if (json.has("member"))
3851      res.setMember(parseReference(getJObject(json, "member")));
3852    if (json.has("onBehalfOf"))
3853      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
3854    if (json.has("period"))
3855      res.setPeriod(parsePeriod(getJObject(json, "period")));
3856  }
3857
3858  protected ChargeItem parseChargeItem(JsonObject json) throws IOException, FHIRFormatError {
3859    ChargeItem res = new ChargeItem();
3860    parseChargeItemProperties(json, res);
3861    return res;
3862  }
3863
3864  protected void parseChargeItemProperties(JsonObject json, ChargeItem res) throws IOException, FHIRFormatError {
3865    parseDomainResourceProperties(json, res);
3866    if (json.has("identifier"))
3867      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
3868    if (json.has("definition")) {
3869      JsonArray array = json.getAsJsonArray("definition");
3870      for (int i = 0; i < array.size(); i++) {
3871        if (array.get(i).isJsonNull()) {
3872          res.getDefinition().add(new UriType());
3873        } else {
3874          res.getDefinition().add(parseUri(array.get(i).getAsString()));
3875        }
3876      }
3877    };
3878    if (json.has("_definition")) {
3879      JsonArray array = json.getAsJsonArray("_definition");
3880      for (int i = 0; i < array.size(); i++) {
3881        if (i == res.getDefinition().size())
3882          res.getDefinition().add(parseUri(null));
3883        if (array.get(i) instanceof JsonObject) 
3884          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinition().get(i));
3885      }
3886    };
3887    if (json.has("status"))
3888      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ChargeItem.ChargeItemStatus.NULL, new ChargeItem.ChargeItemStatusEnumFactory()));
3889    if (json.has("_status"))
3890      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
3891    if (json.has("partOf")) {
3892      JsonArray array = json.getAsJsonArray("partOf");
3893      for (int i = 0; i < array.size(); i++) {
3894        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
3895      }
3896    };
3897    if (json.has("code"))
3898      res.setCode(parseCodeableConcept(getJObject(json, "code")));
3899    if (json.has("subject"))
3900      res.setSubject(parseReference(getJObject(json, "subject")));
3901    if (json.has("context"))
3902      res.setContext(parseReference(getJObject(json, "context")));
3903    Type occurrence = parseType("occurrence", json);
3904    if (occurrence != null)
3905      res.setOccurrence(occurrence);
3906    if (json.has("participant")) {
3907      JsonArray array = json.getAsJsonArray("participant");
3908      for (int i = 0; i < array.size(); i++) {
3909        res.getParticipant().add(parseChargeItemChargeItemParticipantComponent(array.get(i).getAsJsonObject(), res));
3910      }
3911    };
3912    if (json.has("performingOrganization"))
3913      res.setPerformingOrganization(parseReference(getJObject(json, "performingOrganization")));
3914    if (json.has("requestingOrganization"))
3915      res.setRequestingOrganization(parseReference(getJObject(json, "requestingOrganization")));
3916    if (json.has("quantity"))
3917      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
3918    if (json.has("bodysite")) {
3919      JsonArray array = json.getAsJsonArray("bodysite");
3920      for (int i = 0; i < array.size(); i++) {
3921        res.getBodysite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3922      }
3923    };
3924    if (json.has("factorOverride"))
3925      res.setFactorOverrideElement(parseDecimal(json.get("factorOverride").getAsBigDecimal()));
3926    if (json.has("_factorOverride"))
3927      parseElementProperties(getJObject(json, "_factorOverride"), res.getFactorOverrideElement());
3928    if (json.has("priceOverride"))
3929      res.setPriceOverride(parseMoney(getJObject(json, "priceOverride")));
3930    if (json.has("overrideReason"))
3931      res.setOverrideReasonElement(parseString(json.get("overrideReason").getAsString()));
3932    if (json.has("_overrideReason"))
3933      parseElementProperties(getJObject(json, "_overrideReason"), res.getOverrideReasonElement());
3934    if (json.has("enterer"))
3935      res.setEnterer(parseReference(getJObject(json, "enterer")));
3936    if (json.has("enteredDate"))
3937      res.setEnteredDateElement(parseDateTime(json.get("enteredDate").getAsString()));
3938    if (json.has("_enteredDate"))
3939      parseElementProperties(getJObject(json, "_enteredDate"), res.getEnteredDateElement());
3940    if (json.has("reason")) {
3941      JsonArray array = json.getAsJsonArray("reason");
3942      for (int i = 0; i < array.size(); i++) {
3943        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3944      }
3945    };
3946    if (json.has("service")) {
3947      JsonArray array = json.getAsJsonArray("service");
3948      for (int i = 0; i < array.size(); i++) {
3949        res.getService().add(parseReference(array.get(i).getAsJsonObject()));
3950      }
3951    };
3952    if (json.has("account")) {
3953      JsonArray array = json.getAsJsonArray("account");
3954      for (int i = 0; i < array.size(); i++) {
3955        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
3956      }
3957    };
3958    if (json.has("note")) {
3959      JsonArray array = json.getAsJsonArray("note");
3960      for (int i = 0; i < array.size(); i++) {
3961        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
3962      }
3963    };
3964    if (json.has("supportingInformation")) {
3965      JsonArray array = json.getAsJsonArray("supportingInformation");
3966      for (int i = 0; i < array.size(); i++) {
3967        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
3968      }
3969    };
3970  }
3971
3972  protected ChargeItem.ChargeItemParticipantComponent parseChargeItemChargeItemParticipantComponent(JsonObject json, ChargeItem owner) throws IOException, FHIRFormatError {
3973    ChargeItem.ChargeItemParticipantComponent res = new ChargeItem.ChargeItemParticipantComponent();
3974    parseChargeItemChargeItemParticipantComponentProperties(json, owner, res);
3975    return res;
3976  }
3977
3978  protected void parseChargeItemChargeItemParticipantComponentProperties(JsonObject json, ChargeItem owner, ChargeItem.ChargeItemParticipantComponent res) throws IOException, FHIRFormatError {
3979    parseBackboneProperties(json, res);
3980    if (json.has("role"))
3981      res.setRole(parseCodeableConcept(getJObject(json, "role")));
3982    if (json.has("actor"))
3983      res.setActor(parseReference(getJObject(json, "actor")));
3984  }
3985
3986  protected Claim parseClaim(JsonObject json) throws IOException, FHIRFormatError {
3987    Claim res = new Claim();
3988    parseClaimProperties(json, res);
3989    return res;
3990  }
3991
3992  protected void parseClaimProperties(JsonObject json, Claim res) throws IOException, FHIRFormatError {
3993    parseDomainResourceProperties(json, res);
3994    if (json.has("identifier")) {
3995      JsonArray array = json.getAsJsonArray("identifier");
3996      for (int i = 0; i < array.size(); i++) {
3997        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3998      }
3999    };
4000    if (json.has("status"))
4001      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Claim.ClaimStatus.NULL, new Claim.ClaimStatusEnumFactory()));
4002    if (json.has("_status"))
4003      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
4004    if (json.has("type"))
4005      res.setType(parseCodeableConcept(getJObject(json, "type")));
4006    if (json.has("subType")) {
4007      JsonArray array = json.getAsJsonArray("subType");
4008      for (int i = 0; i < array.size(); i++) {
4009        res.getSubType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4010      }
4011    };
4012    if (json.has("use"))
4013      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Claim.Use.NULL, new Claim.UseEnumFactory()));
4014    if (json.has("_use"))
4015      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
4016    if (json.has("patient"))
4017      res.setPatient(parseReference(getJObject(json, "patient")));
4018    if (json.has("billablePeriod"))
4019      res.setBillablePeriod(parsePeriod(getJObject(json, "billablePeriod")));
4020    if (json.has("created"))
4021      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
4022    if (json.has("_created"))
4023      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
4024    if (json.has("enterer"))
4025      res.setEnterer(parseReference(getJObject(json, "enterer")));
4026    if (json.has("insurer"))
4027      res.setInsurer(parseReference(getJObject(json, "insurer")));
4028    if (json.has("provider"))
4029      res.setProvider(parseReference(getJObject(json, "provider")));
4030    if (json.has("organization"))
4031      res.setOrganization(parseReference(getJObject(json, "organization")));
4032    if (json.has("priority"))
4033      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
4034    if (json.has("fundsReserve"))
4035      res.setFundsReserve(parseCodeableConcept(getJObject(json, "fundsReserve")));
4036    if (json.has("related")) {
4037      JsonArray array = json.getAsJsonArray("related");
4038      for (int i = 0; i < array.size(); i++) {
4039        res.getRelated().add(parseClaimRelatedClaimComponent(array.get(i).getAsJsonObject(), res));
4040      }
4041    };
4042    if (json.has("prescription"))
4043      res.setPrescription(parseReference(getJObject(json, "prescription")));
4044    if (json.has("originalPrescription"))
4045      res.setOriginalPrescription(parseReference(getJObject(json, "originalPrescription")));
4046    if (json.has("payee"))
4047      res.setPayee(parseClaimPayeeComponent(getJObject(json, "payee"), res));
4048    if (json.has("referral"))
4049      res.setReferral(parseReference(getJObject(json, "referral")));
4050    if (json.has("facility"))
4051      res.setFacility(parseReference(getJObject(json, "facility")));
4052    if (json.has("careTeam")) {
4053      JsonArray array = json.getAsJsonArray("careTeam");
4054      for (int i = 0; i < array.size(); i++) {
4055        res.getCareTeam().add(parseClaimCareTeamComponent(array.get(i).getAsJsonObject(), res));
4056      }
4057    };
4058    if (json.has("information")) {
4059      JsonArray array = json.getAsJsonArray("information");
4060      for (int i = 0; i < array.size(); i++) {
4061        res.getInformation().add(parseClaimSpecialConditionComponent(array.get(i).getAsJsonObject(), res));
4062      }
4063    };
4064    if (json.has("diagnosis")) {
4065      JsonArray array = json.getAsJsonArray("diagnosis");
4066      for (int i = 0; i < array.size(); i++) {
4067        res.getDiagnosis().add(parseClaimDiagnosisComponent(array.get(i).getAsJsonObject(), res));
4068      }
4069    };
4070    if (json.has("procedure")) {
4071      JsonArray array = json.getAsJsonArray("procedure");
4072      for (int i = 0; i < array.size(); i++) {
4073        res.getProcedure().add(parseClaimProcedureComponent(array.get(i).getAsJsonObject(), res));
4074      }
4075    };
4076    if (json.has("insurance")) {
4077      JsonArray array = json.getAsJsonArray("insurance");
4078      for (int i = 0; i < array.size(); i++) {
4079        res.getInsurance().add(parseClaimInsuranceComponent(array.get(i).getAsJsonObject(), res));
4080      }
4081    };
4082    if (json.has("accident"))
4083      res.setAccident(parseClaimAccidentComponent(getJObject(json, "accident"), res));
4084    if (json.has("employmentImpacted"))
4085      res.setEmploymentImpacted(parsePeriod(getJObject(json, "employmentImpacted")));
4086    if (json.has("hospitalization"))
4087      res.setHospitalization(parsePeriod(getJObject(json, "hospitalization")));
4088    if (json.has("item")) {
4089      JsonArray array = json.getAsJsonArray("item");
4090      for (int i = 0; i < array.size(); i++) {
4091        res.getItem().add(parseClaimItemComponent(array.get(i).getAsJsonObject(), res));
4092      }
4093    };
4094    if (json.has("total"))
4095      res.setTotal(parseMoney(getJObject(json, "total")));
4096  }
4097
4098  protected Claim.RelatedClaimComponent parseClaimRelatedClaimComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4099    Claim.RelatedClaimComponent res = new Claim.RelatedClaimComponent();
4100    parseClaimRelatedClaimComponentProperties(json, owner, res);
4101    return res;
4102  }
4103
4104  protected void parseClaimRelatedClaimComponentProperties(JsonObject json, Claim owner, Claim.RelatedClaimComponent res) throws IOException, FHIRFormatError {
4105    parseBackboneProperties(json, res);
4106    if (json.has("claim"))
4107      res.setClaim(parseReference(getJObject(json, "claim")));
4108    if (json.has("relationship"))
4109      res.setRelationship(parseCodeableConcept(getJObject(json, "relationship")));
4110    if (json.has("reference"))
4111      res.setReference(parseIdentifier(getJObject(json, "reference")));
4112  }
4113
4114  protected Claim.PayeeComponent parseClaimPayeeComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4115    Claim.PayeeComponent res = new Claim.PayeeComponent();
4116    parseClaimPayeeComponentProperties(json, owner, res);
4117    return res;
4118  }
4119
4120  protected void parseClaimPayeeComponentProperties(JsonObject json, Claim owner, Claim.PayeeComponent res) throws IOException, FHIRFormatError {
4121    parseBackboneProperties(json, res);
4122    if (json.has("type"))
4123      res.setType(parseCodeableConcept(getJObject(json, "type")));
4124    if (json.has("resourceType"))
4125      res.setResourceType(parseCoding(getJObject(json, "resourceType")));
4126    if (json.has("party"))
4127      res.setParty(parseReference(getJObject(json, "party")));
4128  }
4129
4130  protected Claim.CareTeamComponent parseClaimCareTeamComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4131    Claim.CareTeamComponent res = new Claim.CareTeamComponent();
4132    parseClaimCareTeamComponentProperties(json, owner, res);
4133    return res;
4134  }
4135
4136  protected void parseClaimCareTeamComponentProperties(JsonObject json, Claim owner, Claim.CareTeamComponent res) throws IOException, FHIRFormatError {
4137    parseBackboneProperties(json, res);
4138    if (json.has("sequence"))
4139      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4140    if (json.has("_sequence"))
4141      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
4142    if (json.has("provider"))
4143      res.setProvider(parseReference(getJObject(json, "provider")));
4144    if (json.has("responsible"))
4145      res.setResponsibleElement(parseBoolean(json.get("responsible").getAsBoolean()));
4146    if (json.has("_responsible"))
4147      parseElementProperties(getJObject(json, "_responsible"), res.getResponsibleElement());
4148    if (json.has("role"))
4149      res.setRole(parseCodeableConcept(getJObject(json, "role")));
4150    if (json.has("qualification"))
4151      res.setQualification(parseCodeableConcept(getJObject(json, "qualification")));
4152  }
4153
4154  protected Claim.SpecialConditionComponent parseClaimSpecialConditionComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4155    Claim.SpecialConditionComponent res = new Claim.SpecialConditionComponent();
4156    parseClaimSpecialConditionComponentProperties(json, owner, res);
4157    return res;
4158  }
4159
4160  protected void parseClaimSpecialConditionComponentProperties(JsonObject json, Claim owner, Claim.SpecialConditionComponent res) throws IOException, FHIRFormatError {
4161    parseBackboneProperties(json, res);
4162    if (json.has("sequence"))
4163      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4164    if (json.has("_sequence"))
4165      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
4166    if (json.has("category"))
4167      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
4168    if (json.has("code"))
4169      res.setCode(parseCodeableConcept(getJObject(json, "code")));
4170    Type timing = parseType("timing", json);
4171    if (timing != null)
4172      res.setTiming(timing);
4173    Type value = parseType("value", json);
4174    if (value != null)
4175      res.setValue(value);
4176    if (json.has("reason"))
4177      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
4178  }
4179
4180  protected Claim.DiagnosisComponent parseClaimDiagnosisComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4181    Claim.DiagnosisComponent res = new Claim.DiagnosisComponent();
4182    parseClaimDiagnosisComponentProperties(json, owner, res);
4183    return res;
4184  }
4185
4186  protected void parseClaimDiagnosisComponentProperties(JsonObject json, Claim owner, Claim.DiagnosisComponent res) throws IOException, FHIRFormatError {
4187    parseBackboneProperties(json, res);
4188    if (json.has("sequence"))
4189      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4190    if (json.has("_sequence"))
4191      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
4192    Type diagnosis = parseType("diagnosis", json);
4193    if (diagnosis != null)
4194      res.setDiagnosis(diagnosis);
4195    if (json.has("type")) {
4196      JsonArray array = json.getAsJsonArray("type");
4197      for (int i = 0; i < array.size(); i++) {
4198        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4199      }
4200    };
4201    if (json.has("packageCode"))
4202      res.setPackageCode(parseCodeableConcept(getJObject(json, "packageCode")));
4203  }
4204
4205  protected Claim.ProcedureComponent parseClaimProcedureComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4206    Claim.ProcedureComponent res = new Claim.ProcedureComponent();
4207    parseClaimProcedureComponentProperties(json, owner, res);
4208    return res;
4209  }
4210
4211  protected void parseClaimProcedureComponentProperties(JsonObject json, Claim owner, Claim.ProcedureComponent res) throws IOException, FHIRFormatError {
4212    parseBackboneProperties(json, res);
4213    if (json.has("sequence"))
4214      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4215    if (json.has("_sequence"))
4216      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
4217    if (json.has("date"))
4218      res.setDateElement(parseDateTime(json.get("date").getAsString()));
4219    if (json.has("_date"))
4220      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
4221    Type procedure = parseType("procedure", json);
4222    if (procedure != null)
4223      res.setProcedure(procedure);
4224  }
4225
4226  protected Claim.InsuranceComponent parseClaimInsuranceComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4227    Claim.InsuranceComponent res = new Claim.InsuranceComponent();
4228    parseClaimInsuranceComponentProperties(json, owner, res);
4229    return res;
4230  }
4231
4232  protected void parseClaimInsuranceComponentProperties(JsonObject json, Claim owner, Claim.InsuranceComponent res) throws IOException, FHIRFormatError {
4233    parseBackboneProperties(json, res);
4234    if (json.has("sequence"))
4235      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4236    if (json.has("_sequence"))
4237      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
4238    if (json.has("focal"))
4239      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
4240    if (json.has("_focal"))
4241      parseElementProperties(getJObject(json, "_focal"), res.getFocalElement());
4242    if (json.has("coverage"))
4243      res.setCoverage(parseReference(getJObject(json, "coverage")));
4244    if (json.has("businessArrangement"))
4245      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
4246    if (json.has("_businessArrangement"))
4247      parseElementProperties(getJObject(json, "_businessArrangement"), res.getBusinessArrangementElement());
4248    if (json.has("preAuthRef")) {
4249      JsonArray array = json.getAsJsonArray("preAuthRef");
4250      for (int i = 0; i < array.size(); i++) {
4251        if (array.get(i).isJsonNull()) {
4252          res.getPreAuthRef().add(new StringType());
4253        } else {
4254          res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
4255        }
4256      }
4257    };
4258    if (json.has("_preAuthRef")) {
4259      JsonArray array = json.getAsJsonArray("_preAuthRef");
4260      for (int i = 0; i < array.size(); i++) {
4261        if (i == res.getPreAuthRef().size())
4262          res.getPreAuthRef().add(parseString(null));
4263        if (array.get(i) instanceof JsonObject) 
4264          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
4265      }
4266    };
4267    if (json.has("claimResponse"))
4268      res.setClaimResponse(parseReference(getJObject(json, "claimResponse")));
4269  }
4270
4271  protected Claim.AccidentComponent parseClaimAccidentComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4272    Claim.AccidentComponent res = new Claim.AccidentComponent();
4273    parseClaimAccidentComponentProperties(json, owner, res);
4274    return res;
4275  }
4276
4277  protected void parseClaimAccidentComponentProperties(JsonObject json, Claim owner, Claim.AccidentComponent res) throws IOException, FHIRFormatError {
4278    parseBackboneProperties(json, res);
4279    if (json.has("date"))
4280      res.setDateElement(parseDate(json.get("date").getAsString()));
4281    if (json.has("_date"))
4282      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
4283    if (json.has("type"))
4284      res.setType(parseCodeableConcept(getJObject(json, "type")));
4285    Type location = parseType("location", json);
4286    if (location != null)
4287      res.setLocation(location);
4288  }
4289
4290  protected Claim.ItemComponent parseClaimItemComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4291    Claim.ItemComponent res = new Claim.ItemComponent();
4292    parseClaimItemComponentProperties(json, owner, res);
4293    return res;
4294  }
4295
4296  protected void parseClaimItemComponentProperties(JsonObject json, Claim owner, Claim.ItemComponent res) throws IOException, FHIRFormatError {
4297    parseBackboneProperties(json, res);
4298    if (json.has("sequence"))
4299      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4300    if (json.has("_sequence"))
4301      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
4302    if (json.has("careTeamLinkId")) {
4303      JsonArray array = json.getAsJsonArray("careTeamLinkId");
4304      for (int i = 0; i < array.size(); i++) {
4305        if (array.get(i).isJsonNull()) {
4306          res.getCareTeamLinkId().add(new PositiveIntType());
4307        } else {
4308          res.getCareTeamLinkId().add(parsePositiveInt(array.get(i).getAsString()));
4309        }
4310      }
4311    };
4312    if (json.has("_careTeamLinkId")) {
4313      JsonArray array = json.getAsJsonArray("_careTeamLinkId");
4314      for (int i = 0; i < array.size(); i++) {
4315        if (i == res.getCareTeamLinkId().size())
4316          res.getCareTeamLinkId().add(parsePositiveInt(null));
4317        if (array.get(i) instanceof JsonObject) 
4318          parseElementProperties(array.get(i).getAsJsonObject(), res.getCareTeamLinkId().get(i));
4319      }
4320    };
4321    if (json.has("diagnosisLinkId")) {
4322      JsonArray array = json.getAsJsonArray("diagnosisLinkId");
4323      for (int i = 0; i < array.size(); i++) {
4324        if (array.get(i).isJsonNull()) {
4325          res.getDiagnosisLinkId().add(new PositiveIntType());
4326        } else {
4327          res.getDiagnosisLinkId().add(parsePositiveInt(array.get(i).getAsString()));
4328        }
4329      }
4330    };
4331    if (json.has("_diagnosisLinkId")) {
4332      JsonArray array = json.getAsJsonArray("_diagnosisLinkId");
4333      for (int i = 0; i < array.size(); i++) {
4334        if (i == res.getDiagnosisLinkId().size())
4335          res.getDiagnosisLinkId().add(parsePositiveInt(null));
4336        if (array.get(i) instanceof JsonObject) 
4337          parseElementProperties(array.get(i).getAsJsonObject(), res.getDiagnosisLinkId().get(i));
4338      }
4339    };
4340    if (json.has("procedureLinkId")) {
4341      JsonArray array = json.getAsJsonArray("procedureLinkId");
4342      for (int i = 0; i < array.size(); i++) {
4343        if (array.get(i).isJsonNull()) {
4344          res.getProcedureLinkId().add(new PositiveIntType());
4345        } else {
4346          res.getProcedureLinkId().add(parsePositiveInt(array.get(i).getAsString()));
4347        }
4348      }
4349    };
4350    if (json.has("_procedureLinkId")) {
4351      JsonArray array = json.getAsJsonArray("_procedureLinkId");
4352      for (int i = 0; i < array.size(); i++) {
4353        if (i == res.getProcedureLinkId().size())
4354          res.getProcedureLinkId().add(parsePositiveInt(null));
4355        if (array.get(i) instanceof JsonObject) 
4356          parseElementProperties(array.get(i).getAsJsonObject(), res.getProcedureLinkId().get(i));
4357      }
4358    };
4359    if (json.has("informationLinkId")) {
4360      JsonArray array = json.getAsJsonArray("informationLinkId");
4361      for (int i = 0; i < array.size(); i++) {
4362        if (array.get(i).isJsonNull()) {
4363          res.getInformationLinkId().add(new PositiveIntType());
4364        } else {
4365          res.getInformationLinkId().add(parsePositiveInt(array.get(i).getAsString()));
4366        }
4367      }
4368    };
4369    if (json.has("_informationLinkId")) {
4370      JsonArray array = json.getAsJsonArray("_informationLinkId");
4371      for (int i = 0; i < array.size(); i++) {
4372        if (i == res.getInformationLinkId().size())
4373          res.getInformationLinkId().add(parsePositiveInt(null));
4374        if (array.get(i) instanceof JsonObject) 
4375          parseElementProperties(array.get(i).getAsJsonObject(), res.getInformationLinkId().get(i));
4376      }
4377    };
4378    if (json.has("revenue"))
4379      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
4380    if (json.has("category"))
4381      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
4382    if (json.has("service"))
4383      res.setService(parseCodeableConcept(getJObject(json, "service")));
4384    if (json.has("modifier")) {
4385      JsonArray array = json.getAsJsonArray("modifier");
4386      for (int i = 0; i < array.size(); i++) {
4387        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4388      }
4389    };
4390    if (json.has("programCode")) {
4391      JsonArray array = json.getAsJsonArray("programCode");
4392      for (int i = 0; i < array.size(); i++) {
4393        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4394      }
4395    };
4396    Type serviced = parseType("serviced", json);
4397    if (serviced != null)
4398      res.setServiced(serviced);
4399    Type location = parseType("location", json);
4400    if (location != null)
4401      res.setLocation(location);
4402    if (json.has("quantity"))
4403      res.setQuantity(parseSimpleQuantity(getJObject(json, "quantity")));
4404    if (json.has("unitPrice"))
4405      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
4406    if (json.has("factor"))
4407      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
4408    if (json.has("_factor"))
4409      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
4410    if (json.has("net"))
4411      res.setNet(parseMoney(getJObject(json, "net")));
4412    if (json.has("udi")) {
4413      JsonArray array = json.getAsJsonArray("udi");
4414      for (int i = 0; i < array.size(); i++) {
4415        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
4416      }
4417    };
4418    if (json.has("bodySite"))
4419      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
4420    if (json.has("subSite")) {
4421      JsonArray array = json.getAsJsonArray("subSite");
4422      for (int i = 0; i < array.size(); i++) {
4423        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4424      }
4425    };
4426    if (json.has("encounter")) {
4427      JsonArray array = json.getAsJsonArray("encounter");
4428      for (int i = 0; i < array.size(); i++) {
4429        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
4430      }
4431    };
4432    if (json.has("detail")) {
4433      JsonArray array = json.getAsJsonArray("detail");
4434      for (int i = 0; i < array.size(); i++) {
4435        res.getDetail().add(parseClaimDetailComponent(array.get(i).getAsJsonObject(), owner));
4436      }
4437    };
4438  }
4439
4440  protected Claim.DetailComponent parseClaimDetailComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4441    Claim.DetailComponent res = new Claim.DetailComponent();
4442    parseClaimDetailComponentProperties(json, owner, res);
4443    return res;
4444  }
4445
4446  protected void parseClaimDetailComponentProperties(JsonObject json, Claim owner, Claim.DetailComponent res) throws IOException, FHIRFormatError {
4447    parseBackboneProperties(json, res);
4448    if (json.has("sequence"))
4449      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4450    if (json.has("_sequence"))
4451      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
4452    if (json.has("revenue"))
4453      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
4454    if (json.has("category"))
4455      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
4456    if (json.has("service"))
4457      res.setService(parseCodeableConcept(getJObject(json, "service")));
4458    if (json.has("modifier")) {
4459      JsonArray array = json.getAsJsonArray("modifier");
4460      for (int i = 0; i < array.size(); i++) {
4461        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4462      }
4463    };
4464    if (json.has("programCode")) {
4465      JsonArray array = json.getAsJsonArray("programCode");
4466      for (int i = 0; i < array.size(); i++) {
4467        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4468      }
4469    };
4470    if (json.has("quantity"))
4471      res.setQuantity(parseSimpleQuantity(getJObject(json, "quantity")));
4472    if (json.has("unitPrice"))
4473      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
4474    if (json.has("factor"))
4475      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
4476    if (json.has("_factor"))
4477      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
4478    if (json.has("net"))
4479      res.setNet(parseMoney(getJObject(json, "net")));
4480    if (json.has("udi")) {
4481      JsonArray array = json.getAsJsonArray("udi");
4482      for (int i = 0; i < array.size(); i++) {
4483        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
4484      }
4485    };
4486    if (json.has("subDetail")) {
4487      JsonArray array = json.getAsJsonArray("subDetail");
4488      for (int i = 0; i < array.size(); i++) {
4489        res.getSubDetail().add(parseClaimSubDetailComponent(array.get(i).getAsJsonObject(), owner));
4490      }
4491    };
4492  }
4493
4494  protected Claim.SubDetailComponent parseClaimSubDetailComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4495    Claim.SubDetailComponent res = new Claim.SubDetailComponent();
4496    parseClaimSubDetailComponentProperties(json, owner, res);
4497    return res;
4498  }
4499
4500  protected void parseClaimSubDetailComponentProperties(JsonObject json, Claim owner, Claim.SubDetailComponent res) throws IOException, FHIRFormatError {
4501    parseBackboneProperties(json, res);
4502    if (json.has("sequence"))
4503      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4504    if (json.has("_sequence"))
4505      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
4506    if (json.has("revenue"))
4507      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
4508    if (json.has("category"))
4509      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
4510    if (json.has("service"))
4511      res.setService(parseCodeableConcept(getJObject(json, "service")));
4512    if (json.has("modifier")) {
4513      JsonArray array = json.getAsJsonArray("modifier");
4514      for (int i = 0; i < array.size(); i++) {
4515        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4516      }
4517    };
4518    if (json.has("programCode")) {
4519      JsonArray array = json.getAsJsonArray("programCode");
4520      for (int i = 0; i < array.size(); i++) {
4521        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4522      }
4523    };
4524    if (json.has("quantity"))
4525      res.setQuantity(parseSimpleQuantity(getJObject(json, "quantity")));
4526    if (json.has("unitPrice"))
4527      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
4528    if (json.has("factor"))
4529      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
4530    if (json.has("_factor"))
4531      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
4532    if (json.has("net"))
4533      res.setNet(parseMoney(getJObject(json, "net")));
4534    if (json.has("udi")) {
4535      JsonArray array = json.getAsJsonArray("udi");
4536      for (int i = 0; i < array.size(); i++) {
4537        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
4538      }
4539    };
4540  }
4541
4542  protected ClaimResponse parseClaimResponse(JsonObject json) throws IOException, FHIRFormatError {
4543    ClaimResponse res = new ClaimResponse();
4544    parseClaimResponseProperties(json, res);
4545    return res;
4546  }
4547
4548  protected void parseClaimResponseProperties(JsonObject json, ClaimResponse res) throws IOException, FHIRFormatError {
4549    parseDomainResourceProperties(json, res);
4550    if (json.has("identifier")) {
4551      JsonArray array = json.getAsJsonArray("identifier");
4552      for (int i = 0; i < array.size(); i++) {
4553        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4554      }
4555    };
4556    if (json.has("status"))
4557      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ClaimResponse.ClaimResponseStatus.NULL, new ClaimResponse.ClaimResponseStatusEnumFactory()));
4558    if (json.has("_status"))
4559      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
4560    if (json.has("patient"))
4561      res.setPatient(parseReference(getJObject(json, "patient")));
4562    if (json.has("created"))
4563      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
4564    if (json.has("_created"))
4565      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
4566    if (json.has("insurer"))
4567      res.setInsurer(parseReference(getJObject(json, "insurer")));
4568    if (json.has("requestProvider"))
4569      res.setRequestProvider(parseReference(getJObject(json, "requestProvider")));
4570    if (json.has("requestOrganization"))
4571      res.setRequestOrganization(parseReference(getJObject(json, "requestOrganization")));
4572    if (json.has("request"))
4573      res.setRequest(parseReference(getJObject(json, "request")));
4574    if (json.has("outcome"))
4575      res.setOutcome(parseCodeableConcept(getJObject(json, "outcome")));
4576    if (json.has("disposition"))
4577      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
4578    if (json.has("_disposition"))
4579      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
4580    if (json.has("payeeType"))
4581      res.setPayeeType(parseCodeableConcept(getJObject(json, "payeeType")));
4582    if (json.has("item")) {
4583      JsonArray array = json.getAsJsonArray("item");
4584      for (int i = 0; i < array.size(); i++) {
4585        res.getItem().add(parseClaimResponseItemComponent(array.get(i).getAsJsonObject(), res));
4586      }
4587    };
4588    if (json.has("addItem")) {
4589      JsonArray array = json.getAsJsonArray("addItem");
4590      for (int i = 0; i < array.size(); i++) {
4591        res.getAddItem().add(parseClaimResponseAddedItemComponent(array.get(i).getAsJsonObject(), res));
4592      }
4593    };
4594    if (json.has("error")) {
4595      JsonArray array = json.getAsJsonArray("error");
4596      for (int i = 0; i < array.size(); i++) {
4597        res.getError().add(parseClaimResponseErrorComponent(array.get(i).getAsJsonObject(), res));
4598      }
4599    };
4600    if (json.has("totalCost"))
4601      res.setTotalCost(parseMoney(getJObject(json, "totalCost")));
4602    if (json.has("unallocDeductable"))
4603      res.setUnallocDeductable(parseMoney(getJObject(json, "unallocDeductable")));
4604    if (json.has("totalBenefit"))
4605      res.setTotalBenefit(parseMoney(getJObject(json, "totalBenefit")));
4606    if (json.has("payment"))
4607      res.setPayment(parseClaimResponsePaymentComponent(getJObject(json, "payment"), res));
4608    if (json.has("reserved"))
4609      res.setReserved(parseCoding(getJObject(json, "reserved")));
4610    if (json.has("form"))
4611      res.setForm(parseCodeableConcept(getJObject(json, "form")));
4612    if (json.has("processNote")) {
4613      JsonArray array = json.getAsJsonArray("processNote");
4614      for (int i = 0; i < array.size(); i++) {
4615        res.getProcessNote().add(parseClaimResponseNoteComponent(array.get(i).getAsJsonObject(), res));
4616      }
4617    };
4618    if (json.has("communicationRequest")) {
4619      JsonArray array = json.getAsJsonArray("communicationRequest");
4620      for (int i = 0; i < array.size(); i++) {
4621        res.getCommunicationRequest().add(parseReference(array.get(i).getAsJsonObject()));
4622      }
4623    };
4624    if (json.has("insurance")) {
4625      JsonArray array = json.getAsJsonArray("insurance");
4626      for (int i = 0; i < array.size(); i++) {
4627        res.getInsurance().add(parseClaimResponseInsuranceComponent(array.get(i).getAsJsonObject(), res));
4628      }
4629    };
4630  }
4631
4632  protected ClaimResponse.ItemComponent parseClaimResponseItemComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4633    ClaimResponse.ItemComponent res = new ClaimResponse.ItemComponent();
4634    parseClaimResponseItemComponentProperties(json, owner, res);
4635    return res;
4636  }
4637
4638  protected void parseClaimResponseItemComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.ItemComponent res) throws IOException, FHIRFormatError {
4639    parseBackboneProperties(json, res);
4640    if (json.has("sequenceLinkId"))
4641      res.setSequenceLinkIdElement(parsePositiveInt(json.get("sequenceLinkId").getAsString()));
4642    if (json.has("_sequenceLinkId"))
4643      parseElementProperties(getJObject(json, "_sequenceLinkId"), res.getSequenceLinkIdElement());
4644    if (json.has("noteNumber")) {
4645      JsonArray array = json.getAsJsonArray("noteNumber");
4646      for (int i = 0; i < array.size(); i++) {
4647        if (array.get(i).isJsonNull()) {
4648          res.getNoteNumber().add(new PositiveIntType());
4649        } else {
4650          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
4651        }
4652      }
4653    };
4654    if (json.has("_noteNumber")) {
4655      JsonArray array = json.getAsJsonArray("_noteNumber");
4656      for (int i = 0; i < array.size(); i++) {
4657        if (i == res.getNoteNumber().size())
4658          res.getNoteNumber().add(parsePositiveInt(null));
4659        if (array.get(i) instanceof JsonObject) 
4660          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
4661      }
4662    };
4663    if (json.has("adjudication")) {
4664      JsonArray array = json.getAsJsonArray("adjudication");
4665      for (int i = 0; i < array.size(); i++) {
4666        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
4667      }
4668    };
4669    if (json.has("detail")) {
4670      JsonArray array = json.getAsJsonArray("detail");
4671      for (int i = 0; i < array.size(); i++) {
4672        res.getDetail().add(parseClaimResponseItemDetailComponent(array.get(i).getAsJsonObject(), owner));
4673      }
4674    };
4675  }
4676
4677  protected ClaimResponse.AdjudicationComponent parseClaimResponseAdjudicationComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4678    ClaimResponse.AdjudicationComponent res = new ClaimResponse.AdjudicationComponent();
4679    parseClaimResponseAdjudicationComponentProperties(json, owner, res);
4680    return res;
4681  }
4682
4683  protected void parseClaimResponseAdjudicationComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.AdjudicationComponent res) throws IOException, FHIRFormatError {
4684    parseBackboneProperties(json, res);
4685    if (json.has("category"))
4686      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
4687    if (json.has("reason"))
4688      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
4689    if (json.has("amount"))
4690      res.setAmount(parseMoney(getJObject(json, "amount")));
4691    if (json.has("value"))
4692      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
4693    if (json.has("_value"))
4694      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
4695  }
4696
4697  protected ClaimResponse.ItemDetailComponent parseClaimResponseItemDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4698    ClaimResponse.ItemDetailComponent res = new ClaimResponse.ItemDetailComponent();
4699    parseClaimResponseItemDetailComponentProperties(json, owner, res);
4700    return res;
4701  }
4702
4703  protected void parseClaimResponseItemDetailComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.ItemDetailComponent res) throws IOException, FHIRFormatError {
4704    parseBackboneProperties(json, res);
4705    if (json.has("sequenceLinkId"))
4706      res.setSequenceLinkIdElement(parsePositiveInt(json.get("sequenceLinkId").getAsString()));
4707    if (json.has("_sequenceLinkId"))
4708      parseElementProperties(getJObject(json, "_sequenceLinkId"), res.getSequenceLinkIdElement());
4709    if (json.has("noteNumber")) {
4710      JsonArray array = json.getAsJsonArray("noteNumber");
4711      for (int i = 0; i < array.size(); i++) {
4712        if (array.get(i).isJsonNull()) {
4713          res.getNoteNumber().add(new PositiveIntType());
4714        } else {
4715          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
4716        }
4717      }
4718    };
4719    if (json.has("_noteNumber")) {
4720      JsonArray array = json.getAsJsonArray("_noteNumber");
4721      for (int i = 0; i < array.size(); i++) {
4722        if (i == res.getNoteNumber().size())
4723          res.getNoteNumber().add(parsePositiveInt(null));
4724        if (array.get(i) instanceof JsonObject) 
4725          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
4726      }
4727    };
4728    if (json.has("adjudication")) {
4729      JsonArray array = json.getAsJsonArray("adjudication");
4730      for (int i = 0; i < array.size(); i++) {
4731        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
4732      }
4733    };
4734    if (json.has("subDetail")) {
4735      JsonArray array = json.getAsJsonArray("subDetail");
4736      for (int i = 0; i < array.size(); i++) {
4737        res.getSubDetail().add(parseClaimResponseSubDetailComponent(array.get(i).getAsJsonObject(), owner));
4738      }
4739    };
4740  }
4741
4742  protected ClaimResponse.SubDetailComponent parseClaimResponseSubDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4743    ClaimResponse.SubDetailComponent res = new ClaimResponse.SubDetailComponent();
4744    parseClaimResponseSubDetailComponentProperties(json, owner, res);
4745    return res;
4746  }
4747
4748  protected void parseClaimResponseSubDetailComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.SubDetailComponent res) throws IOException, FHIRFormatError {
4749    parseBackboneProperties(json, res);
4750    if (json.has("sequenceLinkId"))
4751      res.setSequenceLinkIdElement(parsePositiveInt(json.get("sequenceLinkId").getAsString()));
4752    if (json.has("_sequenceLinkId"))
4753      parseElementProperties(getJObject(json, "_sequenceLinkId"), res.getSequenceLinkIdElement());
4754    if (json.has("noteNumber")) {
4755      JsonArray array = json.getAsJsonArray("noteNumber");
4756      for (int i = 0; i < array.size(); i++) {
4757        if (array.get(i).isJsonNull()) {
4758          res.getNoteNumber().add(new PositiveIntType());
4759        } else {
4760          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
4761        }
4762      }
4763    };
4764    if (json.has("_noteNumber")) {
4765      JsonArray array = json.getAsJsonArray("_noteNumber");
4766      for (int i = 0; i < array.size(); i++) {
4767        if (i == res.getNoteNumber().size())
4768          res.getNoteNumber().add(parsePositiveInt(null));
4769        if (array.get(i) instanceof JsonObject) 
4770          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
4771      }
4772    };
4773    if (json.has("adjudication")) {
4774      JsonArray array = json.getAsJsonArray("adjudication");
4775      for (int i = 0; i < array.size(); i++) {
4776        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
4777      }
4778    };
4779  }
4780
4781  protected ClaimResponse.AddedItemComponent parseClaimResponseAddedItemComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4782    ClaimResponse.AddedItemComponent res = new ClaimResponse.AddedItemComponent();
4783    parseClaimResponseAddedItemComponentProperties(json, owner, res);
4784    return res;
4785  }
4786
4787  protected void parseClaimResponseAddedItemComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.AddedItemComponent res) throws IOException, FHIRFormatError {
4788    parseBackboneProperties(json, res);
4789    if (json.has("sequenceLinkId")) {
4790      JsonArray array = json.getAsJsonArray("sequenceLinkId");
4791      for (int i = 0; i < array.size(); i++) {
4792        if (array.get(i).isJsonNull()) {
4793          res.getSequenceLinkId().add(new PositiveIntType());
4794        } else {
4795          res.getSequenceLinkId().add(parsePositiveInt(array.get(i).getAsString()));
4796        }
4797      }
4798    };
4799    if (json.has("_sequenceLinkId")) {
4800      JsonArray array = json.getAsJsonArray("_sequenceLinkId");
4801      for (int i = 0; i < array.size(); i++) {
4802        if (i == res.getSequenceLinkId().size())
4803          res.getSequenceLinkId().add(parsePositiveInt(null));
4804        if (array.get(i) instanceof JsonObject) 
4805          parseElementProperties(array.get(i).getAsJsonObject(), res.getSequenceLinkId().get(i));
4806      }
4807    };
4808    if (json.has("revenue"))
4809      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
4810    if (json.has("category"))
4811      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
4812    if (json.has("service"))
4813      res.setService(parseCodeableConcept(getJObject(json, "service")));
4814    if (json.has("modifier")) {
4815      JsonArray array = json.getAsJsonArray("modifier");
4816      for (int i = 0; i < array.size(); i++) {
4817        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4818      }
4819    };
4820    if (json.has("fee"))
4821      res.setFee(parseMoney(getJObject(json, "fee")));
4822    if (json.has("noteNumber")) {
4823      JsonArray array = json.getAsJsonArray("noteNumber");
4824      for (int i = 0; i < array.size(); i++) {
4825        if (array.get(i).isJsonNull()) {
4826          res.getNoteNumber().add(new PositiveIntType());
4827        } else {
4828          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
4829        }
4830      }
4831    };
4832    if (json.has("_noteNumber")) {
4833      JsonArray array = json.getAsJsonArray("_noteNumber");
4834      for (int i = 0; i < array.size(); i++) {
4835        if (i == res.getNoteNumber().size())
4836          res.getNoteNumber().add(parsePositiveInt(null));
4837        if (array.get(i) instanceof JsonObject) 
4838          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
4839      }
4840    };
4841    if (json.has("adjudication")) {
4842      JsonArray array = json.getAsJsonArray("adjudication");
4843      for (int i = 0; i < array.size(); i++) {
4844        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
4845      }
4846    };
4847    if (json.has("detail")) {
4848      JsonArray array = json.getAsJsonArray("detail");
4849      for (int i = 0; i < array.size(); i++) {
4850        res.getDetail().add(parseClaimResponseAddedItemsDetailComponent(array.get(i).getAsJsonObject(), owner));
4851      }
4852    };
4853  }
4854
4855  protected ClaimResponse.AddedItemsDetailComponent parseClaimResponseAddedItemsDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4856    ClaimResponse.AddedItemsDetailComponent res = new ClaimResponse.AddedItemsDetailComponent();
4857    parseClaimResponseAddedItemsDetailComponentProperties(json, owner, res);
4858    return res;
4859  }
4860
4861  protected void parseClaimResponseAddedItemsDetailComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.AddedItemsDetailComponent res) throws IOException, FHIRFormatError {
4862    parseBackboneProperties(json, res);
4863    if (json.has("revenue"))
4864      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
4865    if (json.has("category"))
4866      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
4867    if (json.has("service"))
4868      res.setService(parseCodeableConcept(getJObject(json, "service")));
4869    if (json.has("modifier")) {
4870      JsonArray array = json.getAsJsonArray("modifier");
4871      for (int i = 0; i < array.size(); i++) {
4872        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4873      }
4874    };
4875    if (json.has("fee"))
4876      res.setFee(parseMoney(getJObject(json, "fee")));
4877    if (json.has("noteNumber")) {
4878      JsonArray array = json.getAsJsonArray("noteNumber");
4879      for (int i = 0; i < array.size(); i++) {
4880        if (array.get(i).isJsonNull()) {
4881          res.getNoteNumber().add(new PositiveIntType());
4882        } else {
4883          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
4884        }
4885      }
4886    };
4887    if (json.has("_noteNumber")) {
4888      JsonArray array = json.getAsJsonArray("_noteNumber");
4889      for (int i = 0; i < array.size(); i++) {
4890        if (i == res.getNoteNumber().size())
4891          res.getNoteNumber().add(parsePositiveInt(null));
4892        if (array.get(i) instanceof JsonObject) 
4893          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
4894      }
4895    };
4896    if (json.has("adjudication")) {
4897      JsonArray array = json.getAsJsonArray("adjudication");
4898      for (int i = 0; i < array.size(); i++) {
4899        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
4900      }
4901    };
4902  }
4903
4904  protected ClaimResponse.ErrorComponent parseClaimResponseErrorComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4905    ClaimResponse.ErrorComponent res = new ClaimResponse.ErrorComponent();
4906    parseClaimResponseErrorComponentProperties(json, owner, res);
4907    return res;
4908  }
4909
4910  protected void parseClaimResponseErrorComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.ErrorComponent res) throws IOException, FHIRFormatError {
4911    parseBackboneProperties(json, res);
4912    if (json.has("sequenceLinkId"))
4913      res.setSequenceLinkIdElement(parsePositiveInt(json.get("sequenceLinkId").getAsString()));
4914    if (json.has("_sequenceLinkId"))
4915      parseElementProperties(getJObject(json, "_sequenceLinkId"), res.getSequenceLinkIdElement());
4916    if (json.has("detailSequenceLinkId"))
4917      res.setDetailSequenceLinkIdElement(parsePositiveInt(json.get("detailSequenceLinkId").getAsString()));
4918    if (json.has("_detailSequenceLinkId"))
4919      parseElementProperties(getJObject(json, "_detailSequenceLinkId"), res.getDetailSequenceLinkIdElement());
4920    if (json.has("subdetailSequenceLinkId"))
4921      res.setSubdetailSequenceLinkIdElement(parsePositiveInt(json.get("subdetailSequenceLinkId").getAsString()));
4922    if (json.has("_subdetailSequenceLinkId"))
4923      parseElementProperties(getJObject(json, "_subdetailSequenceLinkId"), res.getSubdetailSequenceLinkIdElement());
4924    if (json.has("code"))
4925      res.setCode(parseCodeableConcept(getJObject(json, "code")));
4926  }
4927
4928  protected ClaimResponse.PaymentComponent parseClaimResponsePaymentComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4929    ClaimResponse.PaymentComponent res = new ClaimResponse.PaymentComponent();
4930    parseClaimResponsePaymentComponentProperties(json, owner, res);
4931    return res;
4932  }
4933
4934  protected void parseClaimResponsePaymentComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.PaymentComponent res) throws IOException, FHIRFormatError {
4935    parseBackboneProperties(json, res);
4936    if (json.has("type"))
4937      res.setType(parseCodeableConcept(getJObject(json, "type")));
4938    if (json.has("adjustment"))
4939      res.setAdjustment(parseMoney(getJObject(json, "adjustment")));
4940    if (json.has("adjustmentReason"))
4941      res.setAdjustmentReason(parseCodeableConcept(getJObject(json, "adjustmentReason")));
4942    if (json.has("date"))
4943      res.setDateElement(parseDate(json.get("date").getAsString()));
4944    if (json.has("_date"))
4945      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
4946    if (json.has("amount"))
4947      res.setAmount(parseMoney(getJObject(json, "amount")));
4948    if (json.has("identifier"))
4949      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
4950  }
4951
4952  protected ClaimResponse.NoteComponent parseClaimResponseNoteComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4953    ClaimResponse.NoteComponent res = new ClaimResponse.NoteComponent();
4954    parseClaimResponseNoteComponentProperties(json, owner, res);
4955    return res;
4956  }
4957
4958  protected void parseClaimResponseNoteComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.NoteComponent res) throws IOException, FHIRFormatError {
4959    parseBackboneProperties(json, res);
4960    if (json.has("number"))
4961      res.setNumberElement(parsePositiveInt(json.get("number").getAsString()));
4962    if (json.has("_number"))
4963      parseElementProperties(getJObject(json, "_number"), res.getNumberElement());
4964    if (json.has("type"))
4965      res.setType(parseCodeableConcept(getJObject(json, "type")));
4966    if (json.has("text"))
4967      res.setTextElement(parseString(json.get("text").getAsString()));
4968    if (json.has("_text"))
4969      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
4970    if (json.has("language"))
4971      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
4972  }
4973
4974  protected ClaimResponse.InsuranceComponent parseClaimResponseInsuranceComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4975    ClaimResponse.InsuranceComponent res = new ClaimResponse.InsuranceComponent();
4976    parseClaimResponseInsuranceComponentProperties(json, owner, res);
4977    return res;
4978  }
4979
4980  protected void parseClaimResponseInsuranceComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.InsuranceComponent res) throws IOException, FHIRFormatError {
4981    parseBackboneProperties(json, res);
4982    if (json.has("sequence"))
4983      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4984    if (json.has("_sequence"))
4985      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
4986    if (json.has("focal"))
4987      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
4988    if (json.has("_focal"))
4989      parseElementProperties(getJObject(json, "_focal"), res.getFocalElement());
4990    if (json.has("coverage"))
4991      res.setCoverage(parseReference(getJObject(json, "coverage")));
4992    if (json.has("businessArrangement"))
4993      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
4994    if (json.has("_businessArrangement"))
4995      parseElementProperties(getJObject(json, "_businessArrangement"), res.getBusinessArrangementElement());
4996    if (json.has("preAuthRef")) {
4997      JsonArray array = json.getAsJsonArray("preAuthRef");
4998      for (int i = 0; i < array.size(); i++) {
4999        if (array.get(i).isJsonNull()) {
5000          res.getPreAuthRef().add(new StringType());
5001        } else {
5002          res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
5003        }
5004      }
5005    };
5006    if (json.has("_preAuthRef")) {
5007      JsonArray array = json.getAsJsonArray("_preAuthRef");
5008      for (int i = 0; i < array.size(); i++) {
5009        if (i == res.getPreAuthRef().size())
5010          res.getPreAuthRef().add(parseString(null));
5011        if (array.get(i) instanceof JsonObject) 
5012          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
5013      }
5014    };
5015    if (json.has("claimResponse"))
5016      res.setClaimResponse(parseReference(getJObject(json, "claimResponse")));
5017  }
5018
5019  protected ClinicalImpression parseClinicalImpression(JsonObject json) throws IOException, FHIRFormatError {
5020    ClinicalImpression res = new ClinicalImpression();
5021    parseClinicalImpressionProperties(json, res);
5022    return res;
5023  }
5024
5025  protected void parseClinicalImpressionProperties(JsonObject json, ClinicalImpression res) throws IOException, FHIRFormatError {
5026    parseDomainResourceProperties(json, res);
5027    if (json.has("identifier")) {
5028      JsonArray array = json.getAsJsonArray("identifier");
5029      for (int i = 0; i < array.size(); i++) {
5030        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5031      }
5032    };
5033    if (json.has("status"))
5034      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ClinicalImpression.ClinicalImpressionStatus.NULL, new ClinicalImpression.ClinicalImpressionStatusEnumFactory()));
5035    if (json.has("_status"))
5036      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
5037    if (json.has("code"))
5038      res.setCode(parseCodeableConcept(getJObject(json, "code")));
5039    if (json.has("description"))
5040      res.setDescriptionElement(parseString(json.get("description").getAsString()));
5041    if (json.has("_description"))
5042      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
5043    if (json.has("subject"))
5044      res.setSubject(parseReference(getJObject(json, "subject")));
5045    if (json.has("context"))
5046      res.setContext(parseReference(getJObject(json, "context")));
5047    Type effective = parseType("effective", json);
5048    if (effective != null)
5049      res.setEffective(effective);
5050    if (json.has("date"))
5051      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5052    if (json.has("_date"))
5053      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
5054    if (json.has("assessor"))
5055      res.setAssessor(parseReference(getJObject(json, "assessor")));
5056    if (json.has("previous"))
5057      res.setPrevious(parseReference(getJObject(json, "previous")));
5058    if (json.has("problem")) {
5059      JsonArray array = json.getAsJsonArray("problem");
5060      for (int i = 0; i < array.size(); i++) {
5061        res.getProblem().add(parseReference(array.get(i).getAsJsonObject()));
5062      }
5063    };
5064    if (json.has("investigation")) {
5065      JsonArray array = json.getAsJsonArray("investigation");
5066      for (int i = 0; i < array.size(); i++) {
5067        res.getInvestigation().add(parseClinicalImpressionClinicalImpressionInvestigationComponent(array.get(i).getAsJsonObject(), res));
5068      }
5069    };
5070    if (json.has("protocol")) {
5071      JsonArray array = json.getAsJsonArray("protocol");
5072      for (int i = 0; i < array.size(); i++) {
5073        if (array.get(i).isJsonNull()) {
5074          res.getProtocol().add(new UriType());
5075        } else {
5076          res.getProtocol().add(parseUri(array.get(i).getAsString()));
5077        }
5078      }
5079    };
5080    if (json.has("_protocol")) {
5081      JsonArray array = json.getAsJsonArray("_protocol");
5082      for (int i = 0; i < array.size(); i++) {
5083        if (i == res.getProtocol().size())
5084          res.getProtocol().add(parseUri(null));
5085        if (array.get(i) instanceof JsonObject) 
5086          parseElementProperties(array.get(i).getAsJsonObject(), res.getProtocol().get(i));
5087      }
5088    };
5089    if (json.has("summary"))
5090      res.setSummaryElement(parseString(json.get("summary").getAsString()));
5091    if (json.has("_summary"))
5092      parseElementProperties(getJObject(json, "_summary"), res.getSummaryElement());
5093    if (json.has("finding")) {
5094      JsonArray array = json.getAsJsonArray("finding");
5095      for (int i = 0; i < array.size(); i++) {
5096        res.getFinding().add(parseClinicalImpressionClinicalImpressionFindingComponent(array.get(i).getAsJsonObject(), res));
5097      }
5098    };
5099    if (json.has("prognosisCodeableConcept")) {
5100      JsonArray array = json.getAsJsonArray("prognosisCodeableConcept");
5101      for (int i = 0; i < array.size(); i++) {
5102        res.getPrognosisCodeableConcept().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5103      }
5104    };
5105    if (json.has("prognosisReference")) {
5106      JsonArray array = json.getAsJsonArray("prognosisReference");
5107      for (int i = 0; i < array.size(); i++) {
5108        res.getPrognosisReference().add(parseReference(array.get(i).getAsJsonObject()));
5109      }
5110    };
5111    if (json.has("action")) {
5112      JsonArray array = json.getAsJsonArray("action");
5113      for (int i = 0; i < array.size(); i++) {
5114        res.getAction().add(parseReference(array.get(i).getAsJsonObject()));
5115      }
5116    };
5117    if (json.has("note")) {
5118      JsonArray array = json.getAsJsonArray("note");
5119      for (int i = 0; i < array.size(); i++) {
5120        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5121      }
5122    };
5123  }
5124
5125  protected ClinicalImpression.ClinicalImpressionInvestigationComponent parseClinicalImpressionClinicalImpressionInvestigationComponent(JsonObject json, ClinicalImpression owner) throws IOException, FHIRFormatError {
5126    ClinicalImpression.ClinicalImpressionInvestigationComponent res = new ClinicalImpression.ClinicalImpressionInvestigationComponent();
5127    parseClinicalImpressionClinicalImpressionInvestigationComponentProperties(json, owner, res);
5128    return res;
5129  }
5130
5131  protected void parseClinicalImpressionClinicalImpressionInvestigationComponentProperties(JsonObject json, ClinicalImpression owner, ClinicalImpression.ClinicalImpressionInvestigationComponent res) throws IOException, FHIRFormatError {
5132    parseBackboneProperties(json, res);
5133    if (json.has("code"))
5134      res.setCode(parseCodeableConcept(getJObject(json, "code")));
5135    if (json.has("item")) {
5136      JsonArray array = json.getAsJsonArray("item");
5137      for (int i = 0; i < array.size(); i++) {
5138        res.getItem().add(parseReference(array.get(i).getAsJsonObject()));
5139      }
5140    };
5141  }
5142
5143  protected ClinicalImpression.ClinicalImpressionFindingComponent parseClinicalImpressionClinicalImpressionFindingComponent(JsonObject json, ClinicalImpression owner) throws IOException, FHIRFormatError {
5144    ClinicalImpression.ClinicalImpressionFindingComponent res = new ClinicalImpression.ClinicalImpressionFindingComponent();
5145    parseClinicalImpressionClinicalImpressionFindingComponentProperties(json, owner, res);
5146    return res;
5147  }
5148
5149  protected void parseClinicalImpressionClinicalImpressionFindingComponentProperties(JsonObject json, ClinicalImpression owner, ClinicalImpression.ClinicalImpressionFindingComponent res) throws IOException, FHIRFormatError {
5150    parseBackboneProperties(json, res);
5151    Type item = parseType("item", json);
5152    if (item != null)
5153      res.setItem(item);
5154    if (json.has("basis"))
5155      res.setBasisElement(parseString(json.get("basis").getAsString()));
5156    if (json.has("_basis"))
5157      parseElementProperties(getJObject(json, "_basis"), res.getBasisElement());
5158  }
5159
5160  protected CodeSystem parseCodeSystem(JsonObject json) throws IOException, FHIRFormatError {
5161    CodeSystem res = new CodeSystem();
5162    parseCodeSystemProperties(json, res);
5163    return res;
5164  }
5165
5166  protected void parseCodeSystemProperties(JsonObject json, CodeSystem res) throws IOException, FHIRFormatError {
5167    parseDomainResourceProperties(json, res);
5168    if (json.has("url"))
5169      res.setUrlElement(parseUri(json.get("url").getAsString()));
5170    if (json.has("_url"))
5171      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
5172    if (json.has("identifier"))
5173      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
5174    if (json.has("version"))
5175      res.setVersionElement(parseString(json.get("version").getAsString()));
5176    if (json.has("_version"))
5177      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
5178    if (json.has("name"))
5179      res.setNameElement(parseString(json.get("name").getAsString()));
5180    if (json.has("_name"))
5181      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
5182    if (json.has("title"))
5183      res.setTitleElement(parseString(json.get("title").getAsString()));
5184    if (json.has("_title"))
5185      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
5186    if (json.has("status"))
5187      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
5188    if (json.has("_status"))
5189      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
5190    if (json.has("experimental"))
5191      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
5192    if (json.has("_experimental"))
5193      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
5194    if (json.has("date"))
5195      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5196    if (json.has("_date"))
5197      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
5198    if (json.has("publisher"))
5199      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
5200    if (json.has("_publisher"))
5201      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
5202    if (json.has("contact")) {
5203      JsonArray array = json.getAsJsonArray("contact");
5204      for (int i = 0; i < array.size(); i++) {
5205        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
5206      }
5207    };
5208    if (json.has("description"))
5209      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
5210    if (json.has("_description"))
5211      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
5212    if (json.has("useContext")) {
5213      JsonArray array = json.getAsJsonArray("useContext");
5214      for (int i = 0; i < array.size(); i++) {
5215        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
5216      }
5217    };
5218    if (json.has("jurisdiction")) {
5219      JsonArray array = json.getAsJsonArray("jurisdiction");
5220      for (int i = 0; i < array.size(); i++) {
5221        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5222      }
5223    };
5224    if (json.has("purpose"))
5225      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
5226    if (json.has("_purpose"))
5227      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
5228    if (json.has("copyright"))
5229      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
5230    if (json.has("_copyright"))
5231      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
5232    if (json.has("caseSensitive"))
5233      res.setCaseSensitiveElement(parseBoolean(json.get("caseSensitive").getAsBoolean()));
5234    if (json.has("_caseSensitive"))
5235      parseElementProperties(getJObject(json, "_caseSensitive"), res.getCaseSensitiveElement());
5236    if (json.has("valueSet"))
5237      res.setValueSetElement(parseUri(json.get("valueSet").getAsString()));
5238    if (json.has("_valueSet"))
5239      parseElementProperties(getJObject(json, "_valueSet"), res.getValueSetElement());
5240    if (json.has("hierarchyMeaning"))
5241      res.setHierarchyMeaningElement(parseEnumeration(json.get("hierarchyMeaning").getAsString(), CodeSystem.CodeSystemHierarchyMeaning.NULL, new CodeSystem.CodeSystemHierarchyMeaningEnumFactory()));
5242    if (json.has("_hierarchyMeaning"))
5243      parseElementProperties(getJObject(json, "_hierarchyMeaning"), res.getHierarchyMeaningElement());
5244    if (json.has("compositional"))
5245      res.setCompositionalElement(parseBoolean(json.get("compositional").getAsBoolean()));
5246    if (json.has("_compositional"))
5247      parseElementProperties(getJObject(json, "_compositional"), res.getCompositionalElement());
5248    if (json.has("versionNeeded"))
5249      res.setVersionNeededElement(parseBoolean(json.get("versionNeeded").getAsBoolean()));
5250    if (json.has("_versionNeeded"))
5251      parseElementProperties(getJObject(json, "_versionNeeded"), res.getVersionNeededElement());
5252    if (json.has("content"))
5253      res.setContentElement(parseEnumeration(json.get("content").getAsString(), CodeSystem.CodeSystemContentMode.NULL, new CodeSystem.CodeSystemContentModeEnumFactory()));
5254    if (json.has("_content"))
5255      parseElementProperties(getJObject(json, "_content"), res.getContentElement());
5256    if (json.has("count"))
5257      res.setCountElement(parseUnsignedInt(json.get("count").getAsString()));
5258    if (json.has("_count"))
5259      parseElementProperties(getJObject(json, "_count"), res.getCountElement());
5260    if (json.has("filter")) {
5261      JsonArray array = json.getAsJsonArray("filter");
5262      for (int i = 0; i < array.size(); i++) {
5263        res.getFilter().add(parseCodeSystemCodeSystemFilterComponent(array.get(i).getAsJsonObject(), res));
5264      }
5265    };
5266    if (json.has("property")) {
5267      JsonArray array = json.getAsJsonArray("property");
5268      for (int i = 0; i < array.size(); i++) {
5269        res.getProperty().add(parseCodeSystemPropertyComponent(array.get(i).getAsJsonObject(), res));
5270      }
5271    };
5272    if (json.has("concept")) {
5273      JsonArray array = json.getAsJsonArray("concept");
5274      for (int i = 0; i < array.size(); i++) {
5275        res.getConcept().add(parseCodeSystemConceptDefinitionComponent(array.get(i).getAsJsonObject(), res));
5276      }
5277    };
5278  }
5279
5280  protected CodeSystem.CodeSystemFilterComponent parseCodeSystemCodeSystemFilterComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
5281    CodeSystem.CodeSystemFilterComponent res = new CodeSystem.CodeSystemFilterComponent();
5282    parseCodeSystemCodeSystemFilterComponentProperties(json, owner, res);
5283    return res;
5284  }
5285
5286  protected void parseCodeSystemCodeSystemFilterComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.CodeSystemFilterComponent res) throws IOException, FHIRFormatError {
5287    parseBackboneProperties(json, res);
5288    if (json.has("code"))
5289      res.setCodeElement(parseCode(json.get("code").getAsString()));
5290    if (json.has("_code"))
5291      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
5292    if (json.has("description"))
5293      res.setDescriptionElement(parseString(json.get("description").getAsString()));
5294    if (json.has("_description"))
5295      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
5296    if (json.has("operator")) {
5297      JsonArray array = json.getAsJsonArray("operator");
5298      for (int i = 0; i < array.size(); i++) {
5299        if (array.get(i).isJsonNull()) {
5300          res.getOperator().add(new Enumeration<CodeSystem.FilterOperator>());
5301        } else {
5302          res.getOperator().add(parseEnumeration(array.get(i).getAsString(), CodeSystem.FilterOperator.NULL, new CodeSystem.FilterOperatorEnumFactory()));
5303        }
5304      }
5305    };
5306    if (json.has("_operator")) {
5307      JsonArray array = json.getAsJsonArray("_operator");
5308      for (int i = 0; i < array.size(); i++) {
5309        if (i == res.getOperator().size())
5310          res.getOperator().add(parseEnumeration(null, CodeSystem.FilterOperator.NULL, new CodeSystem.FilterOperatorEnumFactory()));
5311        if (array.get(i) instanceof JsonObject) 
5312          parseElementProperties(array.get(i).getAsJsonObject(), res.getOperator().get(i));
5313      }
5314    };
5315    if (json.has("value"))
5316      res.setValueElement(parseString(json.get("value").getAsString()));
5317    if (json.has("_value"))
5318      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
5319  }
5320
5321  protected CodeSystem.PropertyComponent parseCodeSystemPropertyComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
5322    CodeSystem.PropertyComponent res = new CodeSystem.PropertyComponent();
5323    parseCodeSystemPropertyComponentProperties(json, owner, res);
5324    return res;
5325  }
5326
5327  protected void parseCodeSystemPropertyComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.PropertyComponent res) throws IOException, FHIRFormatError {
5328    parseBackboneProperties(json, res);
5329    if (json.has("code"))
5330      res.setCodeElement(parseCode(json.get("code").getAsString()));
5331    if (json.has("_code"))
5332      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
5333    if (json.has("uri"))
5334      res.setUriElement(parseUri(json.get("uri").getAsString()));
5335    if (json.has("_uri"))
5336      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
5337    if (json.has("description"))
5338      res.setDescriptionElement(parseString(json.get("description").getAsString()));
5339    if (json.has("_description"))
5340      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
5341    if (json.has("type"))
5342      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), CodeSystem.PropertyType.NULL, new CodeSystem.PropertyTypeEnumFactory()));
5343    if (json.has("_type"))
5344      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
5345  }
5346
5347  protected CodeSystem.ConceptDefinitionComponent parseCodeSystemConceptDefinitionComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
5348    CodeSystem.ConceptDefinitionComponent res = new CodeSystem.ConceptDefinitionComponent();
5349    parseCodeSystemConceptDefinitionComponentProperties(json, owner, res);
5350    return res;
5351  }
5352
5353  protected void parseCodeSystemConceptDefinitionComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.ConceptDefinitionComponent res) throws IOException, FHIRFormatError {
5354    parseBackboneProperties(json, res);
5355    if (json.has("code"))
5356      res.setCodeElement(parseCode(json.get("code").getAsString()));
5357    if (json.has("_code"))
5358      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
5359    if (json.has("display"))
5360      res.setDisplayElement(parseString(json.get("display").getAsString()));
5361    if (json.has("_display"))
5362      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
5363    if (json.has("definition"))
5364      res.setDefinitionElement(parseString(json.get("definition").getAsString()));
5365    if (json.has("_definition"))
5366      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
5367    if (json.has("designation")) {
5368      JsonArray array = json.getAsJsonArray("designation");
5369      for (int i = 0; i < array.size(); i++) {
5370        res.getDesignation().add(parseCodeSystemConceptDefinitionDesignationComponent(array.get(i).getAsJsonObject(), owner));
5371      }
5372    };
5373    if (json.has("property")) {
5374      JsonArray array = json.getAsJsonArray("property");
5375      for (int i = 0; i < array.size(); i++) {
5376        res.getProperty().add(parseCodeSystemConceptPropertyComponent(array.get(i).getAsJsonObject(), owner));
5377      }
5378    };
5379    if (json.has("concept")) {
5380      JsonArray array = json.getAsJsonArray("concept");
5381      for (int i = 0; i < array.size(); i++) {
5382        res.getConcept().add(parseCodeSystemConceptDefinitionComponent(array.get(i).getAsJsonObject(), owner));
5383      }
5384    };
5385  }
5386
5387  protected CodeSystem.ConceptDefinitionDesignationComponent parseCodeSystemConceptDefinitionDesignationComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
5388    CodeSystem.ConceptDefinitionDesignationComponent res = new CodeSystem.ConceptDefinitionDesignationComponent();
5389    parseCodeSystemConceptDefinitionDesignationComponentProperties(json, owner, res);
5390    return res;
5391  }
5392
5393  protected void parseCodeSystemConceptDefinitionDesignationComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.ConceptDefinitionDesignationComponent res) throws IOException, FHIRFormatError {
5394    parseBackboneProperties(json, res);
5395    if (json.has("language"))
5396      res.setLanguageElement(parseCode(json.get("language").getAsString()));
5397    if (json.has("_language"))
5398      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
5399    if (json.has("use"))
5400      res.setUse(parseCoding(getJObject(json, "use")));
5401    if (json.has("value"))
5402      res.setValueElement(parseString(json.get("value").getAsString()));
5403    if (json.has("_value"))
5404      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
5405  }
5406
5407  protected CodeSystem.ConceptPropertyComponent parseCodeSystemConceptPropertyComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
5408    CodeSystem.ConceptPropertyComponent res = new CodeSystem.ConceptPropertyComponent();
5409    parseCodeSystemConceptPropertyComponentProperties(json, owner, res);
5410    return res;
5411  }
5412
5413  protected void parseCodeSystemConceptPropertyComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.ConceptPropertyComponent res) throws IOException, FHIRFormatError {
5414    parseBackboneProperties(json, res);
5415    if (json.has("code"))
5416      res.setCodeElement(parseCode(json.get("code").getAsString()));
5417    if (json.has("_code"))
5418      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
5419    Type value = parseType("value", json);
5420    if (value != null)
5421      res.setValue(value);
5422  }
5423
5424  protected Communication parseCommunication(JsonObject json) throws IOException, FHIRFormatError {
5425    Communication res = new Communication();
5426    parseCommunicationProperties(json, res);
5427    return res;
5428  }
5429
5430  protected void parseCommunicationProperties(JsonObject json, Communication res) throws IOException, FHIRFormatError {
5431    parseDomainResourceProperties(json, res);
5432    if (json.has("identifier")) {
5433      JsonArray array = json.getAsJsonArray("identifier");
5434      for (int i = 0; i < array.size(); i++) {
5435        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5436      }
5437    };
5438    if (json.has("definition")) {
5439      JsonArray array = json.getAsJsonArray("definition");
5440      for (int i = 0; i < array.size(); i++) {
5441        res.getDefinition().add(parseReference(array.get(i).getAsJsonObject()));
5442      }
5443    };
5444    if (json.has("basedOn")) {
5445      JsonArray array = json.getAsJsonArray("basedOn");
5446      for (int i = 0; i < array.size(); i++) {
5447        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
5448      }
5449    };
5450    if (json.has("partOf")) {
5451      JsonArray array = json.getAsJsonArray("partOf");
5452      for (int i = 0; i < array.size(); i++) {
5453        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
5454      }
5455    };
5456    if (json.has("status"))
5457      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Communication.CommunicationStatus.NULL, new Communication.CommunicationStatusEnumFactory()));
5458    if (json.has("_status"))
5459      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
5460    if (json.has("notDone"))
5461      res.setNotDoneElement(parseBoolean(json.get("notDone").getAsBoolean()));
5462    if (json.has("_notDone"))
5463      parseElementProperties(getJObject(json, "_notDone"), res.getNotDoneElement());
5464    if (json.has("notDoneReason"))
5465      res.setNotDoneReason(parseCodeableConcept(getJObject(json, "notDoneReason")));
5466    if (json.has("category")) {
5467      JsonArray array = json.getAsJsonArray("category");
5468      for (int i = 0; i < array.size(); i++) {
5469        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5470      }
5471    };
5472    if (json.has("medium")) {
5473      JsonArray array = json.getAsJsonArray("medium");
5474      for (int i = 0; i < array.size(); i++) {
5475        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5476      }
5477    };
5478    if (json.has("subject"))
5479      res.setSubject(parseReference(getJObject(json, "subject")));
5480    if (json.has("recipient")) {
5481      JsonArray array = json.getAsJsonArray("recipient");
5482      for (int i = 0; i < array.size(); i++) {
5483        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
5484      }
5485    };
5486    if (json.has("topic")) {
5487      JsonArray array = json.getAsJsonArray("topic");
5488      for (int i = 0; i < array.size(); i++) {
5489        res.getTopic().add(parseReference(array.get(i).getAsJsonObject()));
5490      }
5491    };
5492    if (json.has("context"))
5493      res.setContext(parseReference(getJObject(json, "context")));
5494    if (json.has("sent"))
5495      res.setSentElement(parseDateTime(json.get("sent").getAsString()));
5496    if (json.has("_sent"))
5497      parseElementProperties(getJObject(json, "_sent"), res.getSentElement());
5498    if (json.has("received"))
5499      res.setReceivedElement(parseDateTime(json.get("received").getAsString()));
5500    if (json.has("_received"))
5501      parseElementProperties(getJObject(json, "_received"), res.getReceivedElement());
5502    if (json.has("sender"))
5503      res.setSender(parseReference(getJObject(json, "sender")));
5504    if (json.has("reasonCode")) {
5505      JsonArray array = json.getAsJsonArray("reasonCode");
5506      for (int i = 0; i < array.size(); i++) {
5507        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5508      }
5509    };
5510    if (json.has("reasonReference")) {
5511      JsonArray array = json.getAsJsonArray("reasonReference");
5512      for (int i = 0; i < array.size(); i++) {
5513        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
5514      }
5515    };
5516    if (json.has("payload")) {
5517      JsonArray array = json.getAsJsonArray("payload");
5518      for (int i = 0; i < array.size(); i++) {
5519        res.getPayload().add(parseCommunicationCommunicationPayloadComponent(array.get(i).getAsJsonObject(), res));
5520      }
5521    };
5522    if (json.has("note")) {
5523      JsonArray array = json.getAsJsonArray("note");
5524      for (int i = 0; i < array.size(); i++) {
5525        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5526      }
5527    };
5528  }
5529
5530  protected Communication.CommunicationPayloadComponent parseCommunicationCommunicationPayloadComponent(JsonObject json, Communication owner) throws IOException, FHIRFormatError {
5531    Communication.CommunicationPayloadComponent res = new Communication.CommunicationPayloadComponent();
5532    parseCommunicationCommunicationPayloadComponentProperties(json, owner, res);
5533    return res;
5534  }
5535
5536  protected void parseCommunicationCommunicationPayloadComponentProperties(JsonObject json, Communication owner, Communication.CommunicationPayloadComponent res) throws IOException, FHIRFormatError {
5537    parseBackboneProperties(json, res);
5538    Type content = parseType("content", json);
5539    if (content != null)
5540      res.setContent(content);
5541  }
5542
5543  protected CommunicationRequest parseCommunicationRequest(JsonObject json) throws IOException, FHIRFormatError {
5544    CommunicationRequest res = new CommunicationRequest();
5545    parseCommunicationRequestProperties(json, res);
5546    return res;
5547  }
5548
5549  protected void parseCommunicationRequestProperties(JsonObject json, CommunicationRequest res) throws IOException, FHIRFormatError {
5550    parseDomainResourceProperties(json, res);
5551    if (json.has("identifier")) {
5552      JsonArray array = json.getAsJsonArray("identifier");
5553      for (int i = 0; i < array.size(); i++) {
5554        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5555      }
5556    };
5557    if (json.has("basedOn")) {
5558      JsonArray array = json.getAsJsonArray("basedOn");
5559      for (int i = 0; i < array.size(); i++) {
5560        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
5561      }
5562    };
5563    if (json.has("replaces")) {
5564      JsonArray array = json.getAsJsonArray("replaces");
5565      for (int i = 0; i < array.size(); i++) {
5566        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
5567      }
5568    };
5569    if (json.has("groupIdentifier"))
5570      res.setGroupIdentifier(parseIdentifier(getJObject(json, "groupIdentifier")));
5571    if (json.has("status"))
5572      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CommunicationRequest.CommunicationRequestStatus.NULL, new CommunicationRequest.CommunicationRequestStatusEnumFactory()));
5573    if (json.has("_status"))
5574      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
5575    if (json.has("category")) {
5576      JsonArray array = json.getAsJsonArray("category");
5577      for (int i = 0; i < array.size(); i++) {
5578        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5579      }
5580    };
5581    if (json.has("priority"))
5582      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), CommunicationRequest.CommunicationPriority.NULL, new CommunicationRequest.CommunicationPriorityEnumFactory()));
5583    if (json.has("_priority"))
5584      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
5585    if (json.has("medium")) {
5586      JsonArray array = json.getAsJsonArray("medium");
5587      for (int i = 0; i < array.size(); i++) {
5588        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5589      }
5590    };
5591    if (json.has("subject"))
5592      res.setSubject(parseReference(getJObject(json, "subject")));
5593    if (json.has("recipient")) {
5594      JsonArray array = json.getAsJsonArray("recipient");
5595      for (int i = 0; i < array.size(); i++) {
5596        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
5597      }
5598    };
5599    if (json.has("topic")) {
5600      JsonArray array = json.getAsJsonArray("topic");
5601      for (int i = 0; i < array.size(); i++) {
5602        res.getTopic().add(parseReference(array.get(i).getAsJsonObject()));
5603      }
5604    };
5605    if (json.has("context"))
5606      res.setContext(parseReference(getJObject(json, "context")));
5607    if (json.has("payload")) {
5608      JsonArray array = json.getAsJsonArray("payload");
5609      for (int i = 0; i < array.size(); i++) {
5610        res.getPayload().add(parseCommunicationRequestCommunicationRequestPayloadComponent(array.get(i).getAsJsonObject(), res));
5611      }
5612    };
5613    Type occurrence = parseType("occurrence", json);
5614    if (occurrence != null)
5615      res.setOccurrence(occurrence);
5616    if (json.has("authoredOn"))
5617      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
5618    if (json.has("_authoredOn"))
5619      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
5620    if (json.has("sender"))
5621      res.setSender(parseReference(getJObject(json, "sender")));
5622    if (json.has("requester"))
5623      res.setRequester(parseCommunicationRequestCommunicationRequestRequesterComponent(getJObject(json, "requester"), res));
5624    if (json.has("reasonCode")) {
5625      JsonArray array = json.getAsJsonArray("reasonCode");
5626      for (int i = 0; i < array.size(); i++) {
5627        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5628      }
5629    };
5630    if (json.has("reasonReference")) {
5631      JsonArray array = json.getAsJsonArray("reasonReference");
5632      for (int i = 0; i < array.size(); i++) {
5633        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
5634      }
5635    };
5636    if (json.has("note")) {
5637      JsonArray array = json.getAsJsonArray("note");
5638      for (int i = 0; i < array.size(); i++) {
5639        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5640      }
5641    };
5642  }
5643
5644  protected CommunicationRequest.CommunicationRequestPayloadComponent parseCommunicationRequestCommunicationRequestPayloadComponent(JsonObject json, CommunicationRequest owner) throws IOException, FHIRFormatError {
5645    CommunicationRequest.CommunicationRequestPayloadComponent res = new CommunicationRequest.CommunicationRequestPayloadComponent();
5646    parseCommunicationRequestCommunicationRequestPayloadComponentProperties(json, owner, res);
5647    return res;
5648  }
5649
5650  protected void parseCommunicationRequestCommunicationRequestPayloadComponentProperties(JsonObject json, CommunicationRequest owner, CommunicationRequest.CommunicationRequestPayloadComponent res) throws IOException, FHIRFormatError {
5651    parseBackboneProperties(json, res);
5652    Type content = parseType("content", json);
5653    if (content != null)
5654      res.setContent(content);
5655  }
5656
5657  protected CommunicationRequest.CommunicationRequestRequesterComponent parseCommunicationRequestCommunicationRequestRequesterComponent(JsonObject json, CommunicationRequest owner) throws IOException, FHIRFormatError {
5658    CommunicationRequest.CommunicationRequestRequesterComponent res = new CommunicationRequest.CommunicationRequestRequesterComponent();
5659    parseCommunicationRequestCommunicationRequestRequesterComponentProperties(json, owner, res);
5660    return res;
5661  }
5662
5663  protected void parseCommunicationRequestCommunicationRequestRequesterComponentProperties(JsonObject json, CommunicationRequest owner, CommunicationRequest.CommunicationRequestRequesterComponent res) throws IOException, FHIRFormatError {
5664    parseBackboneProperties(json, res);
5665    if (json.has("agent"))
5666      res.setAgent(parseReference(getJObject(json, "agent")));
5667    if (json.has("onBehalfOf"))
5668      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
5669  }
5670
5671  protected CompartmentDefinition parseCompartmentDefinition(JsonObject json) throws IOException, FHIRFormatError {
5672    CompartmentDefinition res = new CompartmentDefinition();
5673    parseCompartmentDefinitionProperties(json, res);
5674    return res;
5675  }
5676
5677  protected void parseCompartmentDefinitionProperties(JsonObject json, CompartmentDefinition res) throws IOException, FHIRFormatError {
5678    parseDomainResourceProperties(json, res);
5679    if (json.has("url"))
5680      res.setUrlElement(parseUri(json.get("url").getAsString()));
5681    if (json.has("_url"))
5682      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
5683    if (json.has("name"))
5684      res.setNameElement(parseString(json.get("name").getAsString()));
5685    if (json.has("_name"))
5686      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
5687    if (json.has("title"))
5688      res.setTitleElement(parseString(json.get("title").getAsString()));
5689    if (json.has("_title"))
5690      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
5691    if (json.has("status"))
5692      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
5693    if (json.has("_status"))
5694      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
5695    if (json.has("experimental"))
5696      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
5697    if (json.has("_experimental"))
5698      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
5699    if (json.has("date"))
5700      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5701    if (json.has("_date"))
5702      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
5703    if (json.has("publisher"))
5704      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
5705    if (json.has("_publisher"))
5706      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
5707    if (json.has("contact")) {
5708      JsonArray array = json.getAsJsonArray("contact");
5709      for (int i = 0; i < array.size(); i++) {
5710        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
5711      }
5712    };
5713    if (json.has("description"))
5714      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
5715    if (json.has("_description"))
5716      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
5717    if (json.has("purpose"))
5718      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
5719    if (json.has("_purpose"))
5720      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
5721    if (json.has("useContext")) {
5722      JsonArray array = json.getAsJsonArray("useContext");
5723      for (int i = 0; i < array.size(); i++) {
5724        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
5725      }
5726    };
5727    if (json.has("jurisdiction")) {
5728      JsonArray array = json.getAsJsonArray("jurisdiction");
5729      for (int i = 0; i < array.size(); i++) {
5730        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5731      }
5732    };
5733    if (json.has("code"))
5734      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CompartmentDefinition.CompartmentType.NULL, new CompartmentDefinition.CompartmentTypeEnumFactory()));
5735    if (json.has("_code"))
5736      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
5737    if (json.has("search"))
5738      res.setSearchElement(parseBoolean(json.get("search").getAsBoolean()));
5739    if (json.has("_search"))
5740      parseElementProperties(getJObject(json, "_search"), res.getSearchElement());
5741    if (json.has("resource")) {
5742      JsonArray array = json.getAsJsonArray("resource");
5743      for (int i = 0; i < array.size(); i++) {
5744        res.getResource().add(parseCompartmentDefinitionCompartmentDefinitionResourceComponent(array.get(i).getAsJsonObject(), res));
5745      }
5746    };
5747  }
5748
5749  protected CompartmentDefinition.CompartmentDefinitionResourceComponent parseCompartmentDefinitionCompartmentDefinitionResourceComponent(JsonObject json, CompartmentDefinition owner) throws IOException, FHIRFormatError {
5750    CompartmentDefinition.CompartmentDefinitionResourceComponent res = new CompartmentDefinition.CompartmentDefinitionResourceComponent();
5751    parseCompartmentDefinitionCompartmentDefinitionResourceComponentProperties(json, owner, res);
5752    return res;
5753  }
5754
5755  protected void parseCompartmentDefinitionCompartmentDefinitionResourceComponentProperties(JsonObject json, CompartmentDefinition owner, CompartmentDefinition.CompartmentDefinitionResourceComponent res) throws IOException, FHIRFormatError {
5756    parseBackboneProperties(json, res);
5757    if (json.has("code"))
5758      res.setCodeElement(parseCode(json.get("code").getAsString()));
5759    if (json.has("_code"))
5760      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
5761    if (json.has("param")) {
5762      JsonArray array = json.getAsJsonArray("param");
5763      for (int i = 0; i < array.size(); i++) {
5764        if (array.get(i).isJsonNull()) {
5765          res.getParam().add(new StringType());
5766        } else {
5767          res.getParam().add(parseString(array.get(i).getAsString()));
5768        }
5769      }
5770    };
5771    if (json.has("_param")) {
5772      JsonArray array = json.getAsJsonArray("_param");
5773      for (int i = 0; i < array.size(); i++) {
5774        if (i == res.getParam().size())
5775          res.getParam().add(parseString(null));
5776        if (array.get(i) instanceof JsonObject) 
5777          parseElementProperties(array.get(i).getAsJsonObject(), res.getParam().get(i));
5778      }
5779    };
5780    if (json.has("documentation"))
5781      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
5782    if (json.has("_documentation"))
5783      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
5784  }
5785
5786  protected Composition parseComposition(JsonObject json) throws IOException, FHIRFormatError {
5787    Composition res = new Composition();
5788    parseCompositionProperties(json, res);
5789    return res;
5790  }
5791
5792  protected void parseCompositionProperties(JsonObject json, Composition res) throws IOException, FHIRFormatError {
5793    parseDomainResourceProperties(json, res);
5794    if (json.has("identifier"))
5795      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
5796    if (json.has("status"))
5797      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Composition.CompositionStatus.NULL, new Composition.CompositionStatusEnumFactory()));
5798    if (json.has("_status"))
5799      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
5800    if (json.has("type"))
5801      res.setType(parseCodeableConcept(getJObject(json, "type")));
5802    if (json.has("class"))
5803      res.setClass_(parseCodeableConcept(getJObject(json, "class")));
5804    if (json.has("subject"))
5805      res.setSubject(parseReference(getJObject(json, "subject")));
5806    if (json.has("encounter"))
5807      res.setEncounter(parseReference(getJObject(json, "encounter")));
5808    if (json.has("date"))
5809      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5810    if (json.has("_date"))
5811      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
5812    if (json.has("author")) {
5813      JsonArray array = json.getAsJsonArray("author");
5814      for (int i = 0; i < array.size(); i++) {
5815        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
5816      }
5817    };
5818    if (json.has("title"))
5819      res.setTitleElement(parseString(json.get("title").getAsString()));
5820    if (json.has("_title"))
5821      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
5822    if (json.has("confidentiality"))
5823      res.setConfidentialityElement(parseEnumeration(json.get("confidentiality").getAsString(), Composition.DocumentConfidentiality.NULL, new Composition.DocumentConfidentialityEnumFactory()));
5824    if (json.has("_confidentiality"))
5825      parseElementProperties(getJObject(json, "_confidentiality"), res.getConfidentialityElement());
5826    if (json.has("attester")) {
5827      JsonArray array = json.getAsJsonArray("attester");
5828      for (int i = 0; i < array.size(); i++) {
5829        res.getAttester().add(parseCompositionCompositionAttesterComponent(array.get(i).getAsJsonObject(), res));
5830      }
5831    };
5832    if (json.has("custodian"))
5833      res.setCustodian(parseReference(getJObject(json, "custodian")));
5834    if (json.has("relatesTo")) {
5835      JsonArray array = json.getAsJsonArray("relatesTo");
5836      for (int i = 0; i < array.size(); i++) {
5837        res.getRelatesTo().add(parseCompositionCompositionRelatesToComponent(array.get(i).getAsJsonObject(), res));
5838      }
5839    };
5840    if (json.has("event")) {
5841      JsonArray array = json.getAsJsonArray("event");
5842      for (int i = 0; i < array.size(); i++) {
5843        res.getEvent().add(parseCompositionCompositionEventComponent(array.get(i).getAsJsonObject(), res));
5844      }
5845    };
5846    if (json.has("section")) {
5847      JsonArray array = json.getAsJsonArray("section");
5848      for (int i = 0; i < array.size(); i++) {
5849        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject(), res));
5850      }
5851    };
5852  }
5853
5854  protected Composition.CompositionAttesterComponent parseCompositionCompositionAttesterComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
5855    Composition.CompositionAttesterComponent res = new Composition.CompositionAttesterComponent();
5856    parseCompositionCompositionAttesterComponentProperties(json, owner, res);
5857    return res;
5858  }
5859
5860  protected void parseCompositionCompositionAttesterComponentProperties(JsonObject json, Composition owner, Composition.CompositionAttesterComponent res) throws IOException, FHIRFormatError {
5861    parseBackboneProperties(json, res);
5862    if (json.has("mode")) {
5863      JsonArray array = json.getAsJsonArray("mode");
5864      for (int i = 0; i < array.size(); i++) {
5865        if (array.get(i).isJsonNull()) {
5866          res.getMode().add(new Enumeration<Composition.CompositionAttestationMode>());
5867        } else {
5868          res.getMode().add(parseEnumeration(array.get(i).getAsString(), Composition.CompositionAttestationMode.NULL, new Composition.CompositionAttestationModeEnumFactory()));
5869        }
5870      }
5871    };
5872    if (json.has("_mode")) {
5873      JsonArray array = json.getAsJsonArray("_mode");
5874      for (int i = 0; i < array.size(); i++) {
5875        if (i == res.getMode().size())
5876          res.getMode().add(parseEnumeration(null, Composition.CompositionAttestationMode.NULL, new Composition.CompositionAttestationModeEnumFactory()));
5877        if (array.get(i) instanceof JsonObject) 
5878          parseElementProperties(array.get(i).getAsJsonObject(), res.getMode().get(i));
5879      }
5880    };
5881    if (json.has("time"))
5882      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
5883    if (json.has("_time"))
5884      parseElementProperties(getJObject(json, "_time"), res.getTimeElement());
5885    if (json.has("party"))
5886      res.setParty(parseReference(getJObject(json, "party")));
5887  }
5888
5889  protected Composition.CompositionRelatesToComponent parseCompositionCompositionRelatesToComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
5890    Composition.CompositionRelatesToComponent res = new Composition.CompositionRelatesToComponent();
5891    parseCompositionCompositionRelatesToComponentProperties(json, owner, res);
5892    return res;
5893  }
5894
5895  protected void parseCompositionCompositionRelatesToComponentProperties(JsonObject json, Composition owner, Composition.CompositionRelatesToComponent res) throws IOException, FHIRFormatError {
5896    parseBackboneProperties(json, res);
5897    if (json.has("code"))
5898      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), Composition.DocumentRelationshipType.NULL, new Composition.DocumentRelationshipTypeEnumFactory()));
5899    if (json.has("_code"))
5900      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
5901    Type target = parseType("target", json);
5902    if (target != null)
5903      res.setTarget(target);
5904  }
5905
5906  protected Composition.CompositionEventComponent parseCompositionCompositionEventComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
5907    Composition.CompositionEventComponent res = new Composition.CompositionEventComponent();
5908    parseCompositionCompositionEventComponentProperties(json, owner, res);
5909    return res;
5910  }
5911
5912  protected void parseCompositionCompositionEventComponentProperties(JsonObject json, Composition owner, Composition.CompositionEventComponent res) throws IOException, FHIRFormatError {
5913    parseBackboneProperties(json, res);
5914    if (json.has("code")) {
5915      JsonArray array = json.getAsJsonArray("code");
5916      for (int i = 0; i < array.size(); i++) {
5917        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5918      }
5919    };
5920    if (json.has("period"))
5921      res.setPeriod(parsePeriod(getJObject(json, "period")));
5922    if (json.has("detail")) {
5923      JsonArray array = json.getAsJsonArray("detail");
5924      for (int i = 0; i < array.size(); i++) {
5925        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
5926      }
5927    };
5928  }
5929
5930  protected Composition.SectionComponent parseCompositionSectionComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
5931    Composition.SectionComponent res = new Composition.SectionComponent();
5932    parseCompositionSectionComponentProperties(json, owner, res);
5933    return res;
5934  }
5935
5936  protected void parseCompositionSectionComponentProperties(JsonObject json, Composition owner, Composition.SectionComponent res) throws IOException, FHIRFormatError {
5937    parseBackboneProperties(json, res);
5938    if (json.has("title"))
5939      res.setTitleElement(parseString(json.get("title").getAsString()));
5940    if (json.has("_title"))
5941      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
5942    if (json.has("code"))
5943      res.setCode(parseCodeableConcept(getJObject(json, "code")));
5944    if (json.has("text"))
5945      res.setText(parseNarrative(getJObject(json, "text")));
5946    if (json.has("mode"))
5947      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Composition.SectionMode.NULL, new Composition.SectionModeEnumFactory()));
5948    if (json.has("_mode"))
5949      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
5950    if (json.has("orderedBy"))
5951      res.setOrderedBy(parseCodeableConcept(getJObject(json, "orderedBy")));
5952    if (json.has("entry")) {
5953      JsonArray array = json.getAsJsonArray("entry");
5954      for (int i = 0; i < array.size(); i++) {
5955        res.getEntry().add(parseReference(array.get(i).getAsJsonObject()));
5956      }
5957    };
5958    if (json.has("emptyReason"))
5959      res.setEmptyReason(parseCodeableConcept(getJObject(json, "emptyReason")));
5960    if (json.has("section")) {
5961      JsonArray array = json.getAsJsonArray("section");
5962      for (int i = 0; i < array.size(); i++) {
5963        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject(), owner));
5964      }
5965    };
5966  }
5967
5968  protected ConceptMap parseConceptMap(JsonObject json) throws IOException, FHIRFormatError {
5969    ConceptMap res = new ConceptMap();
5970    parseConceptMapProperties(json, res);
5971    return res;
5972  }
5973
5974  protected void parseConceptMapProperties(JsonObject json, ConceptMap res) throws IOException, FHIRFormatError {
5975    parseDomainResourceProperties(json, res);
5976    if (json.has("url"))
5977      res.setUrlElement(parseUri(json.get("url").getAsString()));
5978    if (json.has("_url"))
5979      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
5980    if (json.has("identifier"))
5981      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
5982    if (json.has("version"))
5983      res.setVersionElement(parseString(json.get("version").getAsString()));
5984    if (json.has("_version"))
5985      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
5986    if (json.has("name"))
5987      res.setNameElement(parseString(json.get("name").getAsString()));
5988    if (json.has("_name"))
5989      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
5990    if (json.has("title"))
5991      res.setTitleElement(parseString(json.get("title").getAsString()));
5992    if (json.has("_title"))
5993      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
5994    if (json.has("status"))
5995      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
5996    if (json.has("_status"))
5997      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
5998    if (json.has("experimental"))
5999      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
6000    if (json.has("_experimental"))
6001      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
6002    if (json.has("date"))
6003      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6004    if (json.has("_date"))
6005      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
6006    if (json.has("publisher"))
6007      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
6008    if (json.has("_publisher"))
6009      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
6010    if (json.has("contact")) {
6011      JsonArray array = json.getAsJsonArray("contact");
6012      for (int i = 0; i < array.size(); i++) {
6013        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
6014      }
6015    };
6016    if (json.has("description"))
6017      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
6018    if (json.has("_description"))
6019      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
6020    if (json.has("useContext")) {
6021      JsonArray array = json.getAsJsonArray("useContext");
6022      for (int i = 0; i < array.size(); i++) {
6023        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
6024      }
6025    };
6026    if (json.has("jurisdiction")) {
6027      JsonArray array = json.getAsJsonArray("jurisdiction");
6028      for (int i = 0; i < array.size(); i++) {
6029        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6030      }
6031    };
6032    if (json.has("purpose"))
6033      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
6034    if (json.has("_purpose"))
6035      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
6036    if (json.has("copyright"))
6037      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
6038    if (json.has("_copyright"))
6039      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
6040    Type source = parseType("source", json);
6041    if (source != null)
6042      res.setSource(source);
6043    Type target = parseType("target", json);
6044    if (target != null)
6045      res.setTarget(target);
6046    if (json.has("group")) {
6047      JsonArray array = json.getAsJsonArray("group");
6048      for (int i = 0; i < array.size(); i++) {
6049        res.getGroup().add(parseConceptMapConceptMapGroupComponent(array.get(i).getAsJsonObject(), res));
6050      }
6051    };
6052  }
6053
6054  protected ConceptMap.ConceptMapGroupComponent parseConceptMapConceptMapGroupComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
6055    ConceptMap.ConceptMapGroupComponent res = new ConceptMap.ConceptMapGroupComponent();
6056    parseConceptMapConceptMapGroupComponentProperties(json, owner, res);
6057    return res;
6058  }
6059
6060  protected void parseConceptMapConceptMapGroupComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.ConceptMapGroupComponent res) throws IOException, FHIRFormatError {
6061    parseBackboneProperties(json, res);
6062    if (json.has("source"))
6063      res.setSourceElement(parseUri(json.get("source").getAsString()));
6064    if (json.has("_source"))
6065      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
6066    if (json.has("sourceVersion"))
6067      res.setSourceVersionElement(parseString(json.get("sourceVersion").getAsString()));
6068    if (json.has("_sourceVersion"))
6069      parseElementProperties(getJObject(json, "_sourceVersion"), res.getSourceVersionElement());
6070    if (json.has("target"))
6071      res.setTargetElement(parseUri(json.get("target").getAsString()));
6072    if (json.has("_target"))
6073      parseElementProperties(getJObject(json, "_target"), res.getTargetElement());
6074    if (json.has("targetVersion"))
6075      res.setTargetVersionElement(parseString(json.get("targetVersion").getAsString()));
6076    if (json.has("_targetVersion"))
6077      parseElementProperties(getJObject(json, "_targetVersion"), res.getTargetVersionElement());
6078    if (json.has("element")) {
6079      JsonArray array = json.getAsJsonArray("element");
6080      for (int i = 0; i < array.size(); i++) {
6081        res.getElement().add(parseConceptMapSourceElementComponent(array.get(i).getAsJsonObject(), owner));
6082      }
6083    };
6084    if (json.has("unmapped"))
6085      res.setUnmapped(parseConceptMapConceptMapGroupUnmappedComponent(getJObject(json, "unmapped"), owner));
6086  }
6087
6088  protected ConceptMap.SourceElementComponent parseConceptMapSourceElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
6089    ConceptMap.SourceElementComponent res = new ConceptMap.SourceElementComponent();
6090    parseConceptMapSourceElementComponentProperties(json, owner, res);
6091    return res;
6092  }
6093
6094  protected void parseConceptMapSourceElementComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.SourceElementComponent res) throws IOException, FHIRFormatError {
6095    parseBackboneProperties(json, res);
6096    if (json.has("code"))
6097      res.setCodeElement(parseCode(json.get("code").getAsString()));
6098    if (json.has("_code"))
6099      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
6100    if (json.has("display"))
6101      res.setDisplayElement(parseString(json.get("display").getAsString()));
6102    if (json.has("_display"))
6103      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
6104    if (json.has("target")) {
6105      JsonArray array = json.getAsJsonArray("target");
6106      for (int i = 0; i < array.size(); i++) {
6107        res.getTarget().add(parseConceptMapTargetElementComponent(array.get(i).getAsJsonObject(), owner));
6108      }
6109    };
6110  }
6111
6112  protected ConceptMap.TargetElementComponent parseConceptMapTargetElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
6113    ConceptMap.TargetElementComponent res = new ConceptMap.TargetElementComponent();
6114    parseConceptMapTargetElementComponentProperties(json, owner, res);
6115    return res;
6116  }
6117
6118  protected void parseConceptMapTargetElementComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.TargetElementComponent res) throws IOException, FHIRFormatError {
6119    parseBackboneProperties(json, res);
6120    if (json.has("code"))
6121      res.setCodeElement(parseCode(json.get("code").getAsString()));
6122    if (json.has("_code"))
6123      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
6124    if (json.has("display"))
6125      res.setDisplayElement(parseString(json.get("display").getAsString()));
6126    if (json.has("_display"))
6127      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
6128    if (json.has("equivalence"))
6129      res.setEquivalenceElement(parseEnumeration(json.get("equivalence").getAsString(), Enumerations.ConceptMapEquivalence.NULL, new Enumerations.ConceptMapEquivalenceEnumFactory()));
6130    if (json.has("_equivalence"))
6131      parseElementProperties(getJObject(json, "_equivalence"), res.getEquivalenceElement());
6132    if (json.has("comment"))
6133      res.setCommentElement(parseString(json.get("comment").getAsString()));
6134    if (json.has("_comment"))
6135      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
6136    if (json.has("dependsOn")) {
6137      JsonArray array = json.getAsJsonArray("dependsOn");
6138      for (int i = 0; i < array.size(); i++) {
6139        res.getDependsOn().add(parseConceptMapOtherElementComponent(array.get(i).getAsJsonObject(), owner));
6140      }
6141    };
6142    if (json.has("product")) {
6143      JsonArray array = json.getAsJsonArray("product");
6144      for (int i = 0; i < array.size(); i++) {
6145        res.getProduct().add(parseConceptMapOtherElementComponent(array.get(i).getAsJsonObject(), owner));
6146      }
6147    };
6148  }
6149
6150  protected ConceptMap.OtherElementComponent parseConceptMapOtherElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
6151    ConceptMap.OtherElementComponent res = new ConceptMap.OtherElementComponent();
6152    parseConceptMapOtherElementComponentProperties(json, owner, res);
6153    return res;
6154  }
6155
6156  protected void parseConceptMapOtherElementComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.OtherElementComponent res) throws IOException, FHIRFormatError {
6157    parseBackboneProperties(json, res);
6158    if (json.has("property"))
6159      res.setPropertyElement(parseUri(json.get("property").getAsString()));
6160    if (json.has("_property"))
6161      parseElementProperties(getJObject(json, "_property"), res.getPropertyElement());
6162    if (json.has("system"))
6163      res.setSystemElement(parseUri(json.get("system").getAsString()));
6164    if (json.has("_system"))
6165      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
6166    if (json.has("code"))
6167      res.setCodeElement(parseString(json.get("code").getAsString()));
6168    if (json.has("_code"))
6169      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
6170    if (json.has("display"))
6171      res.setDisplayElement(parseString(json.get("display").getAsString()));
6172    if (json.has("_display"))
6173      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
6174  }
6175
6176  protected ConceptMap.ConceptMapGroupUnmappedComponent parseConceptMapConceptMapGroupUnmappedComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
6177    ConceptMap.ConceptMapGroupUnmappedComponent res = new ConceptMap.ConceptMapGroupUnmappedComponent();
6178    parseConceptMapConceptMapGroupUnmappedComponentProperties(json, owner, res);
6179    return res;
6180  }
6181
6182  protected void parseConceptMapConceptMapGroupUnmappedComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.ConceptMapGroupUnmappedComponent res) throws IOException, FHIRFormatError {
6183    parseBackboneProperties(json, res);
6184    if (json.has("mode"))
6185      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), ConceptMap.ConceptMapGroupUnmappedMode.NULL, new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory()));
6186    if (json.has("_mode"))
6187      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
6188    if (json.has("code"))
6189      res.setCodeElement(parseCode(json.get("code").getAsString()));
6190    if (json.has("_code"))
6191      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
6192    if (json.has("display"))
6193      res.setDisplayElement(parseString(json.get("display").getAsString()));
6194    if (json.has("_display"))
6195      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
6196    if (json.has("url"))
6197      res.setUrlElement(parseUri(json.get("url").getAsString()));
6198    if (json.has("_url"))
6199      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
6200  }
6201
6202  protected Condition parseCondition(JsonObject json) throws IOException, FHIRFormatError {
6203    Condition res = new Condition();
6204    parseConditionProperties(json, res);
6205    return res;
6206  }
6207
6208  protected void parseConditionProperties(JsonObject json, Condition res) throws IOException, FHIRFormatError {
6209    parseDomainResourceProperties(json, res);
6210    if (json.has("identifier")) {
6211      JsonArray array = json.getAsJsonArray("identifier");
6212      for (int i = 0; i < array.size(); i++) {
6213        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6214      }
6215    };
6216    if (json.has("clinicalStatus"))
6217      res.setClinicalStatusElement(parseEnumeration(json.get("clinicalStatus").getAsString(), Condition.ConditionClinicalStatus.NULL, new Condition.ConditionClinicalStatusEnumFactory()));
6218    if (json.has("_clinicalStatus"))
6219      parseElementProperties(getJObject(json, "_clinicalStatus"), res.getClinicalStatusElement());
6220    if (json.has("verificationStatus"))
6221      res.setVerificationStatusElement(parseEnumeration(json.get("verificationStatus").getAsString(), Condition.ConditionVerificationStatus.NULL, new Condition.ConditionVerificationStatusEnumFactory()));
6222    if (json.has("_verificationStatus"))
6223      parseElementProperties(getJObject(json, "_verificationStatus"), res.getVerificationStatusElement());
6224    if (json.has("category")) {
6225      JsonArray array = json.getAsJsonArray("category");
6226      for (int i = 0; i < array.size(); i++) {
6227        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6228      }
6229    };
6230    if (json.has("severity"))
6231      res.setSeverity(parseCodeableConcept(getJObject(json, "severity")));
6232    if (json.has("code"))
6233      res.setCode(parseCodeableConcept(getJObject(json, "code")));
6234    if (json.has("bodySite")) {
6235      JsonArray array = json.getAsJsonArray("bodySite");
6236      for (int i = 0; i < array.size(); i++) {
6237        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6238      }
6239    };
6240    if (json.has("subject"))
6241      res.setSubject(parseReference(getJObject(json, "subject")));
6242    if (json.has("context"))
6243      res.setContext(parseReference(getJObject(json, "context")));
6244    Type onset = parseType("onset", json);
6245    if (onset != null)
6246      res.setOnset(onset);
6247    Type abatement = parseType("abatement", json);
6248    if (abatement != null)
6249      res.setAbatement(abatement);
6250    if (json.has("assertedDate"))
6251      res.setAssertedDateElement(parseDateTime(json.get("assertedDate").getAsString()));
6252    if (json.has("_assertedDate"))
6253      parseElementProperties(getJObject(json, "_assertedDate"), res.getAssertedDateElement());
6254    if (json.has("asserter"))
6255      res.setAsserter(parseReference(getJObject(json, "asserter")));
6256    if (json.has("stage"))
6257      res.setStage(parseConditionConditionStageComponent(getJObject(json, "stage"), res));
6258    if (json.has("evidence")) {
6259      JsonArray array = json.getAsJsonArray("evidence");
6260      for (int i = 0; i < array.size(); i++) {
6261        res.getEvidence().add(parseConditionConditionEvidenceComponent(array.get(i).getAsJsonObject(), res));
6262      }
6263    };
6264    if (json.has("note")) {
6265      JsonArray array = json.getAsJsonArray("note");
6266      for (int i = 0; i < array.size(); i++) {
6267        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
6268      }
6269    };
6270  }
6271
6272  protected Condition.ConditionStageComponent parseConditionConditionStageComponent(JsonObject json, Condition owner) throws IOException, FHIRFormatError {
6273    Condition.ConditionStageComponent res = new Condition.ConditionStageComponent();
6274    parseConditionConditionStageComponentProperties(json, owner, res);
6275    return res;
6276  }
6277
6278  protected void parseConditionConditionStageComponentProperties(JsonObject json, Condition owner, Condition.ConditionStageComponent res) throws IOException, FHIRFormatError {
6279    parseBackboneProperties(json, res);
6280    if (json.has("summary"))
6281      res.setSummary(parseCodeableConcept(getJObject(json, "summary")));
6282    if (json.has("assessment")) {
6283      JsonArray array = json.getAsJsonArray("assessment");
6284      for (int i = 0; i < array.size(); i++) {
6285        res.getAssessment().add(parseReference(array.get(i).getAsJsonObject()));
6286      }
6287    };
6288  }
6289
6290  protected Condition.ConditionEvidenceComponent parseConditionConditionEvidenceComponent(JsonObject json, Condition owner) throws IOException, FHIRFormatError {
6291    Condition.ConditionEvidenceComponent res = new Condition.ConditionEvidenceComponent();
6292    parseConditionConditionEvidenceComponentProperties(json, owner, res);
6293    return res;
6294  }
6295
6296  protected void parseConditionConditionEvidenceComponentProperties(JsonObject json, Condition owner, Condition.ConditionEvidenceComponent res) throws IOException, FHIRFormatError {
6297    parseBackboneProperties(json, res);
6298    if (json.has("code")) {
6299      JsonArray array = json.getAsJsonArray("code");
6300      for (int i = 0; i < array.size(); i++) {
6301        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6302      }
6303    };
6304    if (json.has("detail")) {
6305      JsonArray array = json.getAsJsonArray("detail");
6306      for (int i = 0; i < array.size(); i++) {
6307        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
6308      }
6309    };
6310  }
6311
6312  protected Consent parseConsent(JsonObject json) throws IOException, FHIRFormatError {
6313    Consent res = new Consent();
6314    parseConsentProperties(json, res);
6315    return res;
6316  }
6317
6318  protected void parseConsentProperties(JsonObject json, Consent res) throws IOException, FHIRFormatError {
6319    parseDomainResourceProperties(json, res);
6320    if (json.has("identifier"))
6321      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
6322    if (json.has("status"))
6323      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Consent.ConsentState.NULL, new Consent.ConsentStateEnumFactory()));
6324    if (json.has("_status"))
6325      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
6326    if (json.has("category")) {
6327      JsonArray array = json.getAsJsonArray("category");
6328      for (int i = 0; i < array.size(); i++) {
6329        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6330      }
6331    };
6332    if (json.has("patient"))
6333      res.setPatient(parseReference(getJObject(json, "patient")));
6334    if (json.has("period"))
6335      res.setPeriod(parsePeriod(getJObject(json, "period")));
6336    if (json.has("dateTime"))
6337      res.setDateTimeElement(parseDateTime(json.get("dateTime").getAsString()));
6338    if (json.has("_dateTime"))
6339      parseElementProperties(getJObject(json, "_dateTime"), res.getDateTimeElement());
6340    if (json.has("consentingParty")) {
6341      JsonArray array = json.getAsJsonArray("consentingParty");
6342      for (int i = 0; i < array.size(); i++) {
6343        res.getConsentingParty().add(parseReference(array.get(i).getAsJsonObject()));
6344      }
6345    };
6346    if (json.has("actor")) {
6347      JsonArray array = json.getAsJsonArray("actor");
6348      for (int i = 0; i < array.size(); i++) {
6349        res.getActor().add(parseConsentConsentActorComponent(array.get(i).getAsJsonObject(), res));
6350      }
6351    };
6352    if (json.has("action")) {
6353      JsonArray array = json.getAsJsonArray("action");
6354      for (int i = 0; i < array.size(); i++) {
6355        res.getAction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6356      }
6357    };
6358    if (json.has("organization")) {
6359      JsonArray array = json.getAsJsonArray("organization");
6360      for (int i = 0; i < array.size(); i++) {
6361        res.getOrganization().add(parseReference(array.get(i).getAsJsonObject()));
6362      }
6363    };
6364    Type source = parseType("source", json);
6365    if (source != null)
6366      res.setSource(source);
6367    if (json.has("policy")) {
6368      JsonArray array = json.getAsJsonArray("policy");
6369      for (int i = 0; i < array.size(); i++) {
6370        res.getPolicy().add(parseConsentConsentPolicyComponent(array.get(i).getAsJsonObject(), res));
6371      }
6372    };
6373    if (json.has("policyRule"))
6374      res.setPolicyRuleElement(parseUri(json.get("policyRule").getAsString()));
6375    if (json.has("_policyRule"))
6376      parseElementProperties(getJObject(json, "_policyRule"), res.getPolicyRuleElement());
6377    if (json.has("securityLabel")) {
6378      JsonArray array = json.getAsJsonArray("securityLabel");
6379      for (int i = 0; i < array.size(); i++) {
6380        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
6381      }
6382    };
6383    if (json.has("purpose")) {
6384      JsonArray array = json.getAsJsonArray("purpose");
6385      for (int i = 0; i < array.size(); i++) {
6386        res.getPurpose().add(parseCoding(array.get(i).getAsJsonObject()));
6387      }
6388    };
6389    if (json.has("dataPeriod"))
6390      res.setDataPeriod(parsePeriod(getJObject(json, "dataPeriod")));
6391    if (json.has("data")) {
6392      JsonArray array = json.getAsJsonArray("data");
6393      for (int i = 0; i < array.size(); i++) {
6394        res.getData().add(parseConsentConsentDataComponent(array.get(i).getAsJsonObject(), res));
6395      }
6396    };
6397    if (json.has("except")) {
6398      JsonArray array = json.getAsJsonArray("except");
6399      for (int i = 0; i < array.size(); i++) {
6400        res.getExcept().add(parseConsentExceptComponent(array.get(i).getAsJsonObject(), res));
6401      }
6402    };
6403  }
6404
6405  protected Consent.ConsentActorComponent parseConsentConsentActorComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
6406    Consent.ConsentActorComponent res = new Consent.ConsentActorComponent();
6407    parseConsentConsentActorComponentProperties(json, owner, res);
6408    return res;
6409  }
6410
6411  protected void parseConsentConsentActorComponentProperties(JsonObject json, Consent owner, Consent.ConsentActorComponent res) throws IOException, FHIRFormatError {
6412    parseBackboneProperties(json, res);
6413    if (json.has("role"))
6414      res.setRole(parseCodeableConcept(getJObject(json, "role")));
6415    if (json.has("reference"))
6416      res.setReference(parseReference(getJObject(json, "reference")));
6417  }
6418
6419  protected Consent.ConsentPolicyComponent parseConsentConsentPolicyComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
6420    Consent.ConsentPolicyComponent res = new Consent.ConsentPolicyComponent();
6421    parseConsentConsentPolicyComponentProperties(json, owner, res);
6422    return res;
6423  }
6424
6425  protected void parseConsentConsentPolicyComponentProperties(JsonObject json, Consent owner, Consent.ConsentPolicyComponent res) throws IOException, FHIRFormatError {
6426    parseBackboneProperties(json, res);
6427    if (json.has("authority"))
6428      res.setAuthorityElement(parseUri(json.get("authority").getAsString()));
6429    if (json.has("_authority"))
6430      parseElementProperties(getJObject(json, "_authority"), res.getAuthorityElement());
6431    if (json.has("uri"))
6432      res.setUriElement(parseUri(json.get("uri").getAsString()));
6433    if (json.has("_uri"))
6434      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
6435  }
6436
6437  protected Consent.ConsentDataComponent parseConsentConsentDataComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
6438    Consent.ConsentDataComponent res = new Consent.ConsentDataComponent();
6439    parseConsentConsentDataComponentProperties(json, owner, res);
6440    return res;
6441  }
6442
6443  protected void parseConsentConsentDataComponentProperties(JsonObject json, Consent owner, Consent.ConsentDataComponent res) throws IOException, FHIRFormatError {
6444    parseBackboneProperties(json, res);
6445    if (json.has("meaning"))
6446      res.setMeaningElement(parseEnumeration(json.get("meaning").getAsString(), Consent.ConsentDataMeaning.NULL, new Consent.ConsentDataMeaningEnumFactory()));
6447    if (json.has("_meaning"))
6448      parseElementProperties(getJObject(json, "_meaning"), res.getMeaningElement());
6449    if (json.has("reference"))
6450      res.setReference(parseReference(getJObject(json, "reference")));
6451  }
6452
6453  protected Consent.ExceptComponent parseConsentExceptComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
6454    Consent.ExceptComponent res = new Consent.ExceptComponent();
6455    parseConsentExceptComponentProperties(json, owner, res);
6456    return res;
6457  }
6458
6459  protected void parseConsentExceptComponentProperties(JsonObject json, Consent owner, Consent.ExceptComponent res) throws IOException, FHIRFormatError {
6460    parseBackboneProperties(json, res);
6461    if (json.has("type"))
6462      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Consent.ConsentExceptType.NULL, new Consent.ConsentExceptTypeEnumFactory()));
6463    if (json.has("_type"))
6464      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
6465    if (json.has("period"))
6466      res.setPeriod(parsePeriod(getJObject(json, "period")));
6467    if (json.has("actor")) {
6468      JsonArray array = json.getAsJsonArray("actor");
6469      for (int i = 0; i < array.size(); i++) {
6470        res.getActor().add(parseConsentExceptActorComponent(array.get(i).getAsJsonObject(), owner));
6471      }
6472    };
6473    if (json.has("action")) {
6474      JsonArray array = json.getAsJsonArray("action");
6475      for (int i = 0; i < array.size(); i++) {
6476        res.getAction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6477      }
6478    };
6479    if (json.has("securityLabel")) {
6480      JsonArray array = json.getAsJsonArray("securityLabel");
6481      for (int i = 0; i < array.size(); i++) {
6482        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
6483      }
6484    };
6485    if (json.has("purpose")) {
6486      JsonArray array = json.getAsJsonArray("purpose");
6487      for (int i = 0; i < array.size(); i++) {
6488        res.getPurpose().add(parseCoding(array.get(i).getAsJsonObject()));
6489      }
6490    };
6491    if (json.has("class")) {
6492      JsonArray array = json.getAsJsonArray("class");
6493      for (int i = 0; i < array.size(); i++) {
6494        res.getClass_().add(parseCoding(array.get(i).getAsJsonObject()));
6495      }
6496    };
6497    if (json.has("code")) {
6498      JsonArray array = json.getAsJsonArray("code");
6499      for (int i = 0; i < array.size(); i++) {
6500        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
6501      }
6502    };
6503    if (json.has("dataPeriod"))
6504      res.setDataPeriod(parsePeriod(getJObject(json, "dataPeriod")));
6505    if (json.has("data")) {
6506      JsonArray array = json.getAsJsonArray("data");
6507      for (int i = 0; i < array.size(); i++) {
6508        res.getData().add(parseConsentExceptDataComponent(array.get(i).getAsJsonObject(), owner));
6509      }
6510    };
6511  }
6512
6513  protected Consent.ExceptActorComponent parseConsentExceptActorComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
6514    Consent.ExceptActorComponent res = new Consent.ExceptActorComponent();
6515    parseConsentExceptActorComponentProperties(json, owner, res);
6516    return res;
6517  }
6518
6519  protected void parseConsentExceptActorComponentProperties(JsonObject json, Consent owner, Consent.ExceptActorComponent res) throws IOException, FHIRFormatError {
6520    parseBackboneProperties(json, res);
6521    if (json.has("role"))
6522      res.setRole(parseCodeableConcept(getJObject(json, "role")));
6523    if (json.has("reference"))
6524      res.setReference(parseReference(getJObject(json, "reference")));
6525  }
6526
6527  protected Consent.ExceptDataComponent parseConsentExceptDataComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
6528    Consent.ExceptDataComponent res = new Consent.ExceptDataComponent();
6529    parseConsentExceptDataComponentProperties(json, owner, res);
6530    return res;
6531  }
6532
6533  protected void parseConsentExceptDataComponentProperties(JsonObject json, Consent owner, Consent.ExceptDataComponent res) throws IOException, FHIRFormatError {
6534    parseBackboneProperties(json, res);
6535    if (json.has("meaning"))
6536      res.setMeaningElement(parseEnumeration(json.get("meaning").getAsString(), Consent.ConsentDataMeaning.NULL, new Consent.ConsentDataMeaningEnumFactory()));
6537    if (json.has("_meaning"))
6538      parseElementProperties(getJObject(json, "_meaning"), res.getMeaningElement());
6539    if (json.has("reference"))
6540      res.setReference(parseReference(getJObject(json, "reference")));
6541  }
6542
6543  protected Contract parseContract(JsonObject json) throws IOException, FHIRFormatError {
6544    Contract res = new Contract();
6545    parseContractProperties(json, res);
6546    return res;
6547  }
6548
6549  protected void parseContractProperties(JsonObject json, Contract res) throws IOException, FHIRFormatError {
6550    parseDomainResourceProperties(json, res);
6551    if (json.has("identifier"))
6552      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
6553    if (json.has("status"))
6554      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Contract.ContractStatus.NULL, new Contract.ContractStatusEnumFactory()));
6555    if (json.has("_status"))
6556      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
6557    if (json.has("issued"))
6558      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
6559    if (json.has("_issued"))
6560      parseElementProperties(getJObject(json, "_issued"), res.getIssuedElement());
6561    if (json.has("applies"))
6562      res.setApplies(parsePeriod(getJObject(json, "applies")));
6563    if (json.has("subject")) {
6564      JsonArray array = json.getAsJsonArray("subject");
6565      for (int i = 0; i < array.size(); i++) {
6566        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
6567      }
6568    };
6569    if (json.has("topic")) {
6570      JsonArray array = json.getAsJsonArray("topic");
6571      for (int i = 0; i < array.size(); i++) {
6572        res.getTopic().add(parseReference(array.get(i).getAsJsonObject()));
6573      }
6574    };
6575    if (json.has("authority")) {
6576      JsonArray array = json.getAsJsonArray("authority");
6577      for (int i = 0; i < array.size(); i++) {
6578        res.getAuthority().add(parseReference(array.get(i).getAsJsonObject()));
6579      }
6580    };
6581    if (json.has("domain")) {
6582      JsonArray array = json.getAsJsonArray("domain");
6583      for (int i = 0; i < array.size(); i++) {
6584        res.getDomain().add(parseReference(array.get(i).getAsJsonObject()));
6585      }
6586    };
6587    if (json.has("type"))
6588      res.setType(parseCodeableConcept(getJObject(json, "type")));
6589    if (json.has("subType")) {
6590      JsonArray array = json.getAsJsonArray("subType");
6591      for (int i = 0; i < array.size(); i++) {
6592        res.getSubType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6593      }
6594    };
6595    if (json.has("action")) {
6596      JsonArray array = json.getAsJsonArray("action");
6597      for (int i = 0; i < array.size(); i++) {
6598        res.getAction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6599      }
6600    };
6601    if (json.has("actionReason")) {
6602      JsonArray array = json.getAsJsonArray("actionReason");
6603      for (int i = 0; i < array.size(); i++) {
6604        res.getActionReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6605      }
6606    };
6607    if (json.has("decisionType"))
6608      res.setDecisionType(parseCodeableConcept(getJObject(json, "decisionType")));
6609    if (json.has("contentDerivative"))
6610      res.setContentDerivative(parseCodeableConcept(getJObject(json, "contentDerivative")));
6611    if (json.has("securityLabel")) {
6612      JsonArray array = json.getAsJsonArray("securityLabel");
6613      for (int i = 0; i < array.size(); i++) {
6614        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
6615      }
6616    };
6617    if (json.has("agent")) {
6618      JsonArray array = json.getAsJsonArray("agent");
6619      for (int i = 0; i < array.size(); i++) {
6620        res.getAgent().add(parseContractAgentComponent(array.get(i).getAsJsonObject(), res));
6621      }
6622    };
6623    if (json.has("signer")) {
6624      JsonArray array = json.getAsJsonArray("signer");
6625      for (int i = 0; i < array.size(); i++) {
6626        res.getSigner().add(parseContractSignatoryComponent(array.get(i).getAsJsonObject(), res));
6627      }
6628    };
6629    if (json.has("valuedItem")) {
6630      JsonArray array = json.getAsJsonArray("valuedItem");
6631      for (int i = 0; i < array.size(); i++) {
6632        res.getValuedItem().add(parseContractValuedItemComponent(array.get(i).getAsJsonObject(), res));
6633      }
6634    };
6635    if (json.has("term")) {
6636      JsonArray array = json.getAsJsonArray("term");
6637      for (int i = 0; i < array.size(); i++) {
6638        res.getTerm().add(parseContractTermComponent(array.get(i).getAsJsonObject(), res));
6639      }
6640    };
6641    Type binding = parseType("binding", json);
6642    if (binding != null)
6643      res.setBinding(binding);
6644    if (json.has("friendly")) {
6645      JsonArray array = json.getAsJsonArray("friendly");
6646      for (int i = 0; i < array.size(); i++) {
6647        res.getFriendly().add(parseContractFriendlyLanguageComponent(array.get(i).getAsJsonObject(), res));
6648      }
6649    };
6650    if (json.has("legal")) {
6651      JsonArray array = json.getAsJsonArray("legal");
6652      for (int i = 0; i < array.size(); i++) {
6653        res.getLegal().add(parseContractLegalLanguageComponent(array.get(i).getAsJsonObject(), res));
6654      }
6655    };
6656    if (json.has("rule")) {
6657      JsonArray array = json.getAsJsonArray("rule");
6658      for (int i = 0; i < array.size(); i++) {
6659        res.getRule().add(parseContractComputableLanguageComponent(array.get(i).getAsJsonObject(), res));
6660      }
6661    };
6662  }
6663
6664  protected Contract.AgentComponent parseContractAgentComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6665    Contract.AgentComponent res = new Contract.AgentComponent();
6666    parseContractAgentComponentProperties(json, owner, res);
6667    return res;
6668  }
6669
6670  protected void parseContractAgentComponentProperties(JsonObject json, Contract owner, Contract.AgentComponent res) throws IOException, FHIRFormatError {
6671    parseBackboneProperties(json, res);
6672    if (json.has("actor"))
6673      res.setActor(parseReference(getJObject(json, "actor")));
6674    if (json.has("role")) {
6675      JsonArray array = json.getAsJsonArray("role");
6676      for (int i = 0; i < array.size(); i++) {
6677        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6678      }
6679    };
6680  }
6681
6682  protected Contract.SignatoryComponent parseContractSignatoryComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6683    Contract.SignatoryComponent res = new Contract.SignatoryComponent();
6684    parseContractSignatoryComponentProperties(json, owner, res);
6685    return res;
6686  }
6687
6688  protected void parseContractSignatoryComponentProperties(JsonObject json, Contract owner, Contract.SignatoryComponent res) throws IOException, FHIRFormatError {
6689    parseBackboneProperties(json, res);
6690    if (json.has("type"))
6691      res.setType(parseCoding(getJObject(json, "type")));
6692    if (json.has("party"))
6693      res.setParty(parseReference(getJObject(json, "party")));
6694    if (json.has("signature")) {
6695      JsonArray array = json.getAsJsonArray("signature");
6696      for (int i = 0; i < array.size(); i++) {
6697        res.getSignature().add(parseSignature(array.get(i).getAsJsonObject()));
6698      }
6699    };
6700  }
6701
6702  protected Contract.ValuedItemComponent parseContractValuedItemComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6703    Contract.ValuedItemComponent res = new Contract.ValuedItemComponent();
6704    parseContractValuedItemComponentProperties(json, owner, res);
6705    return res;
6706  }
6707
6708  protected void parseContractValuedItemComponentProperties(JsonObject json, Contract owner, Contract.ValuedItemComponent res) throws IOException, FHIRFormatError {
6709    parseBackboneProperties(json, res);
6710    Type entity = parseType("entity", json);
6711    if (entity != null)
6712      res.setEntity(entity);
6713    if (json.has("identifier"))
6714      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
6715    if (json.has("effectiveTime"))
6716      res.setEffectiveTimeElement(parseDateTime(json.get("effectiveTime").getAsString()));
6717    if (json.has("_effectiveTime"))
6718      parseElementProperties(getJObject(json, "_effectiveTime"), res.getEffectiveTimeElement());
6719    if (json.has("quantity"))
6720      res.setQuantity(parseSimpleQuantity(getJObject(json, "quantity")));
6721    if (json.has("unitPrice"))
6722      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
6723    if (json.has("factor"))
6724      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
6725    if (json.has("_factor"))
6726      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
6727    if (json.has("points"))
6728      res.setPointsElement(parseDecimal(json.get("points").getAsBigDecimal()));
6729    if (json.has("_points"))
6730      parseElementProperties(getJObject(json, "_points"), res.getPointsElement());
6731    if (json.has("net"))
6732      res.setNet(parseMoney(getJObject(json, "net")));
6733  }
6734
6735  protected Contract.TermComponent parseContractTermComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6736    Contract.TermComponent res = new Contract.TermComponent();
6737    parseContractTermComponentProperties(json, owner, res);
6738    return res;
6739  }
6740
6741  protected void parseContractTermComponentProperties(JsonObject json, Contract owner, Contract.TermComponent res) throws IOException, FHIRFormatError {
6742    parseBackboneProperties(json, res);
6743    if (json.has("identifier"))
6744      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
6745    if (json.has("issued"))
6746      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
6747    if (json.has("_issued"))
6748      parseElementProperties(getJObject(json, "_issued"), res.getIssuedElement());
6749    if (json.has("applies"))
6750      res.setApplies(parsePeriod(getJObject(json, "applies")));
6751    if (json.has("type"))
6752      res.setType(parseCodeableConcept(getJObject(json, "type")));
6753    if (json.has("subType"))
6754      res.setSubType(parseCodeableConcept(getJObject(json, "subType")));
6755    if (json.has("topic")) {
6756      JsonArray array = json.getAsJsonArray("topic");
6757      for (int i = 0; i < array.size(); i++) {
6758        res.getTopic().add(parseReference(array.get(i).getAsJsonObject()));
6759      }
6760    };
6761    if (json.has("action")) {
6762      JsonArray array = json.getAsJsonArray("action");
6763      for (int i = 0; i < array.size(); i++) {
6764        res.getAction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6765      }
6766    };
6767    if (json.has("actionReason")) {
6768      JsonArray array = json.getAsJsonArray("actionReason");
6769      for (int i = 0; i < array.size(); i++) {
6770        res.getActionReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6771      }
6772    };
6773    if (json.has("securityLabel")) {
6774      JsonArray array = json.getAsJsonArray("securityLabel");
6775      for (int i = 0; i < array.size(); i++) {
6776        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
6777      }
6778    };
6779    if (json.has("agent")) {
6780      JsonArray array = json.getAsJsonArray("agent");
6781      for (int i = 0; i < array.size(); i++) {
6782        res.getAgent().add(parseContractTermAgentComponent(array.get(i).getAsJsonObject(), owner));
6783      }
6784    };
6785    if (json.has("text"))
6786      res.setTextElement(parseString(json.get("text").getAsString()));
6787    if (json.has("_text"))
6788      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
6789    if (json.has("valuedItem")) {
6790      JsonArray array = json.getAsJsonArray("valuedItem");
6791      for (int i = 0; i < array.size(); i++) {
6792        res.getValuedItem().add(parseContractTermValuedItemComponent(array.get(i).getAsJsonObject(), owner));
6793      }
6794    };
6795    if (json.has("group")) {
6796      JsonArray array = json.getAsJsonArray("group");
6797      for (int i = 0; i < array.size(); i++) {
6798        res.getGroup().add(parseContractTermComponent(array.get(i).getAsJsonObject(), owner));
6799      }
6800    };
6801  }
6802
6803  protected Contract.TermAgentComponent parseContractTermAgentComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6804    Contract.TermAgentComponent res = new Contract.TermAgentComponent();
6805    parseContractTermAgentComponentProperties(json, owner, res);
6806    return res;
6807  }
6808
6809  protected void parseContractTermAgentComponentProperties(JsonObject json, Contract owner, Contract.TermAgentComponent res) throws IOException, FHIRFormatError {
6810    parseBackboneProperties(json, res);
6811    if (json.has("actor"))
6812      res.setActor(parseReference(getJObject(json, "actor")));
6813    if (json.has("role")) {
6814      JsonArray array = json.getAsJsonArray("role");
6815      for (int i = 0; i < array.size(); i++) {
6816        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6817      }
6818    };
6819  }
6820
6821  protected Contract.TermValuedItemComponent parseContractTermValuedItemComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6822    Contract.TermValuedItemComponent res = new Contract.TermValuedItemComponent();
6823    parseContractTermValuedItemComponentProperties(json, owner, res);
6824    return res;
6825  }
6826
6827  protected void parseContractTermValuedItemComponentProperties(JsonObject json, Contract owner, Contract.TermValuedItemComponent res) throws IOException, FHIRFormatError {
6828    parseBackboneProperties(json, res);
6829    Type entity = parseType("entity", json);
6830    if (entity != null)
6831      res.setEntity(entity);
6832    if (json.has("identifier"))
6833      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
6834    if (json.has("effectiveTime"))
6835      res.setEffectiveTimeElement(parseDateTime(json.get("effectiveTime").getAsString()));
6836    if (json.has("_effectiveTime"))
6837      parseElementProperties(getJObject(json, "_effectiveTime"), res.getEffectiveTimeElement());
6838    if (json.has("quantity"))
6839      res.setQuantity(parseSimpleQuantity(getJObject(json, "quantity")));
6840    if (json.has("unitPrice"))
6841      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
6842    if (json.has("factor"))
6843      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
6844    if (json.has("_factor"))
6845      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
6846    if (json.has("points"))
6847      res.setPointsElement(parseDecimal(json.get("points").getAsBigDecimal()));
6848    if (json.has("_points"))
6849      parseElementProperties(getJObject(json, "_points"), res.getPointsElement());
6850    if (json.has("net"))
6851      res.setNet(parseMoney(getJObject(json, "net")));
6852  }
6853
6854  protected Contract.FriendlyLanguageComponent parseContractFriendlyLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6855    Contract.FriendlyLanguageComponent res = new Contract.FriendlyLanguageComponent();
6856    parseContractFriendlyLanguageComponentProperties(json, owner, res);
6857    return res;
6858  }
6859
6860  protected void parseContractFriendlyLanguageComponentProperties(JsonObject json, Contract owner, Contract.FriendlyLanguageComponent res) throws IOException, FHIRFormatError {
6861    parseBackboneProperties(json, res);
6862    Type content = parseType("content", json);
6863    if (content != null)
6864      res.setContent(content);
6865  }
6866
6867  protected Contract.LegalLanguageComponent parseContractLegalLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6868    Contract.LegalLanguageComponent res = new Contract.LegalLanguageComponent();
6869    parseContractLegalLanguageComponentProperties(json, owner, res);
6870    return res;
6871  }
6872
6873  protected void parseContractLegalLanguageComponentProperties(JsonObject json, Contract owner, Contract.LegalLanguageComponent res) throws IOException, FHIRFormatError {
6874    parseBackboneProperties(json, res);
6875    Type content = parseType("content", json);
6876    if (content != null)
6877      res.setContent(content);
6878  }
6879
6880  protected Contract.ComputableLanguageComponent parseContractComputableLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6881    Contract.ComputableLanguageComponent res = new Contract.ComputableLanguageComponent();
6882    parseContractComputableLanguageComponentProperties(json, owner, res);
6883    return res;
6884  }
6885
6886  protected void parseContractComputableLanguageComponentProperties(JsonObject json, Contract owner, Contract.ComputableLanguageComponent res) throws IOException, FHIRFormatError {
6887    parseBackboneProperties(json, res);
6888    Type content = parseType("content", json);
6889    if (content != null)
6890      res.setContent(content);
6891  }
6892
6893  protected Coverage parseCoverage(JsonObject json) throws IOException, FHIRFormatError {
6894    Coverage res = new Coverage();
6895    parseCoverageProperties(json, res);
6896    return res;
6897  }
6898
6899  protected void parseCoverageProperties(JsonObject json, Coverage res) throws IOException, FHIRFormatError {
6900    parseDomainResourceProperties(json, res);
6901    if (json.has("identifier")) {
6902      JsonArray array = json.getAsJsonArray("identifier");
6903      for (int i = 0; i < array.size(); i++) {
6904        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6905      }
6906    };
6907    if (json.has("status"))
6908      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Coverage.CoverageStatus.NULL, new Coverage.CoverageStatusEnumFactory()));
6909    if (json.has("_status"))
6910      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
6911    if (json.has("type"))
6912      res.setType(parseCodeableConcept(getJObject(json, "type")));
6913    if (json.has("policyHolder"))
6914      res.setPolicyHolder(parseReference(getJObject(json, "policyHolder")));
6915    if (json.has("subscriber"))
6916      res.setSubscriber(parseReference(getJObject(json, "subscriber")));
6917    if (json.has("subscriberId"))
6918      res.setSubscriberIdElement(parseString(json.get("subscriberId").getAsString()));
6919    if (json.has("_subscriberId"))
6920      parseElementProperties(getJObject(json, "_subscriberId"), res.getSubscriberIdElement());
6921    if (json.has("beneficiary"))
6922      res.setBeneficiary(parseReference(getJObject(json, "beneficiary")));
6923    if (json.has("relationship"))
6924      res.setRelationship(parseCodeableConcept(getJObject(json, "relationship")));
6925    if (json.has("period"))
6926      res.setPeriod(parsePeriod(getJObject(json, "period")));
6927    if (json.has("payor")) {
6928      JsonArray array = json.getAsJsonArray("payor");
6929      for (int i = 0; i < array.size(); i++) {
6930        res.getPayor().add(parseReference(array.get(i).getAsJsonObject()));
6931      }
6932    };
6933    if (json.has("grouping"))
6934      res.setGrouping(parseCoverageGroupComponent(getJObject(json, "grouping"), res));
6935    if (json.has("dependent"))
6936      res.setDependentElement(parseString(json.get("dependent").getAsString()));
6937    if (json.has("_dependent"))
6938      parseElementProperties(getJObject(json, "_dependent"), res.getDependentElement());
6939    if (json.has("sequence"))
6940      res.setSequenceElement(parseString(json.get("sequence").getAsString()));
6941    if (json.has("_sequence"))
6942      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
6943    if (json.has("order"))
6944      res.setOrderElement(parsePositiveInt(json.get("order").getAsString()));
6945    if (json.has("_order"))
6946      parseElementProperties(getJObject(json, "_order"), res.getOrderElement());
6947    if (json.has("network"))
6948      res.setNetworkElement(parseString(json.get("network").getAsString()));
6949    if (json.has("_network"))
6950      parseElementProperties(getJObject(json, "_network"), res.getNetworkElement());
6951    if (json.has("contract")) {
6952      JsonArray array = json.getAsJsonArray("contract");
6953      for (int i = 0; i < array.size(); i++) {
6954        res.getContract().add(parseReference(array.get(i).getAsJsonObject()));
6955      }
6956    };
6957  }
6958
6959  protected Coverage.GroupComponent parseCoverageGroupComponent(JsonObject json, Coverage owner) throws IOException, FHIRFormatError {
6960    Coverage.GroupComponent res = new Coverage.GroupComponent();
6961    parseCoverageGroupComponentProperties(json, owner, res);
6962    return res;
6963  }
6964
6965  protected void parseCoverageGroupComponentProperties(JsonObject json, Coverage owner, Coverage.GroupComponent res) throws IOException, FHIRFormatError {
6966    parseBackboneProperties(json, res);
6967    if (json.has("group"))
6968      res.setGroupElement(parseString(json.get("group").getAsString()));
6969    if (json.has("_group"))
6970      parseElementProperties(getJObject(json, "_group"), res.getGroupElement());
6971    if (json.has("groupDisplay"))
6972      res.setGroupDisplayElement(parseString(json.get("groupDisplay").getAsString()));
6973    if (json.has("_groupDisplay"))
6974      parseElementProperties(getJObject(json, "_groupDisplay"), res.getGroupDisplayElement());
6975    if (json.has("subGroup"))
6976      res.setSubGroupElement(parseString(json.get("subGroup").getAsString()));
6977    if (json.has("_subGroup"))
6978      parseElementProperties(getJObject(json, "_subGroup"), res.getSubGroupElement());
6979    if (json.has("subGroupDisplay"))
6980      res.setSubGroupDisplayElement(parseString(json.get("subGroupDisplay").getAsString()));
6981    if (json.has("_subGroupDisplay"))
6982      parseElementProperties(getJObject(json, "_subGroupDisplay"), res.getSubGroupDisplayElement());
6983    if (json.has("plan"))
6984      res.setPlanElement(parseString(json.get("plan").getAsString()));
6985    if (json.has("_plan"))
6986      parseElementProperties(getJObject(json, "_plan"), res.getPlanElement());
6987    if (json.has("planDisplay"))
6988      res.setPlanDisplayElement(parseString(json.get("planDisplay").getAsString()));
6989    if (json.has("_planDisplay"))
6990      parseElementProperties(getJObject(json, "_planDisplay"), res.getPlanDisplayElement());
6991    if (json.has("subPlan"))
6992      res.setSubPlanElement(parseString(json.get("subPlan").getAsString()));
6993    if (json.has("_subPlan"))
6994      parseElementProperties(getJObject(json, "_subPlan"), res.getSubPlanElement());
6995    if (json.has("subPlanDisplay"))
6996      res.setSubPlanDisplayElement(parseString(json.get("subPlanDisplay").getAsString()));
6997    if (json.has("_subPlanDisplay"))
6998      parseElementProperties(getJObject(json, "_subPlanDisplay"), res.getSubPlanDisplayElement());
6999    if (json.has("class"))
7000      res.setClass_Element(parseString(json.get("class").getAsString()));
7001    if (json.has("_class"))
7002      parseElementProperties(getJObject(json, "_class"), res.getClass_Element());
7003    if (json.has("classDisplay"))
7004      res.setClassDisplayElement(parseString(json.get("classDisplay").getAsString()));
7005    if (json.has("_classDisplay"))
7006      parseElementProperties(getJObject(json, "_classDisplay"), res.getClassDisplayElement());
7007    if (json.has("subClass"))
7008      res.setSubClassElement(parseString(json.get("subClass").getAsString()));
7009    if (json.has("_subClass"))
7010      parseElementProperties(getJObject(json, "_subClass"), res.getSubClassElement());
7011    if (json.has("subClassDisplay"))
7012      res.setSubClassDisplayElement(parseString(json.get("subClassDisplay").getAsString()));
7013    if (json.has("_subClassDisplay"))
7014      parseElementProperties(getJObject(json, "_subClassDisplay"), res.getSubClassDisplayElement());
7015  }
7016
7017  protected DataElement parseDataElement(JsonObject json) throws IOException, FHIRFormatError {
7018    DataElement res = new DataElement();
7019    parseDataElementProperties(json, res);
7020    return res;
7021  }
7022
7023  protected void parseDataElementProperties(JsonObject json, DataElement res) throws IOException, FHIRFormatError {
7024    parseDomainResourceProperties(json, res);
7025    if (json.has("url"))
7026      res.setUrlElement(parseUri(json.get("url").getAsString()));
7027    if (json.has("_url"))
7028      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
7029    if (json.has("identifier")) {
7030      JsonArray array = json.getAsJsonArray("identifier");
7031      for (int i = 0; i < array.size(); i++) {
7032        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7033      }
7034    };
7035    if (json.has("version"))
7036      res.setVersionElement(parseString(json.get("version").getAsString()));
7037    if (json.has("_version"))
7038      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
7039    if (json.has("status"))
7040      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
7041    if (json.has("_status"))
7042      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
7043    if (json.has("experimental"))
7044      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
7045    if (json.has("_experimental"))
7046      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
7047    if (json.has("date"))
7048      res.setDateElement(parseDateTime(json.get("date").getAsString()));
7049    if (json.has("_date"))
7050      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
7051    if (json.has("publisher"))
7052      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
7053    if (json.has("_publisher"))
7054      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
7055    if (json.has("name"))
7056      res.setNameElement(parseString(json.get("name").getAsString()));
7057    if (json.has("_name"))
7058      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
7059    if (json.has("title"))
7060      res.setTitleElement(parseString(json.get("title").getAsString()));
7061    if (json.has("_title"))
7062      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
7063    if (json.has("contact")) {
7064      JsonArray array = json.getAsJsonArray("contact");
7065      for (int i = 0; i < array.size(); i++) {
7066        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
7067      }
7068    };
7069    if (json.has("useContext")) {
7070      JsonArray array = json.getAsJsonArray("useContext");
7071      for (int i = 0; i < array.size(); i++) {
7072        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
7073      }
7074    };
7075    if (json.has("jurisdiction")) {
7076      JsonArray array = json.getAsJsonArray("jurisdiction");
7077      for (int i = 0; i < array.size(); i++) {
7078        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7079      }
7080    };
7081    if (json.has("copyright"))
7082      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
7083    if (json.has("_copyright"))
7084      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
7085    if (json.has("stringency"))
7086      res.setStringencyElement(parseEnumeration(json.get("stringency").getAsString(), DataElement.DataElementStringency.NULL, new DataElement.DataElementStringencyEnumFactory()));
7087    if (json.has("_stringency"))
7088      parseElementProperties(getJObject(json, "_stringency"), res.getStringencyElement());
7089    if (json.has("mapping")) {
7090      JsonArray array = json.getAsJsonArray("mapping");
7091      for (int i = 0; i < array.size(); i++) {
7092        res.getMapping().add(parseDataElementDataElementMappingComponent(array.get(i).getAsJsonObject(), res));
7093      }
7094    };
7095    if (json.has("element")) {
7096      JsonArray array = json.getAsJsonArray("element");
7097      for (int i = 0; i < array.size(); i++) {
7098        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
7099      }
7100    };
7101  }
7102
7103  protected DataElement.DataElementMappingComponent parseDataElementDataElementMappingComponent(JsonObject json, DataElement owner) throws IOException, FHIRFormatError {
7104    DataElement.DataElementMappingComponent res = new DataElement.DataElementMappingComponent();
7105    parseDataElementDataElementMappingComponentProperties(json, owner, res);
7106    return res;
7107  }
7108
7109  protected void parseDataElementDataElementMappingComponentProperties(JsonObject json, DataElement owner, DataElement.DataElementMappingComponent res) throws IOException, FHIRFormatError {
7110    parseBackboneProperties(json, res);
7111    if (json.has("identity"))
7112      res.setIdentityElement(parseId(json.get("identity").getAsString()));
7113    if (json.has("_identity"))
7114      parseElementProperties(getJObject(json, "_identity"), res.getIdentityElement());
7115    if (json.has("uri"))
7116      res.setUriElement(parseUri(json.get("uri").getAsString()));
7117    if (json.has("_uri"))
7118      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
7119    if (json.has("name"))
7120      res.setNameElement(parseString(json.get("name").getAsString()));
7121    if (json.has("_name"))
7122      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
7123    if (json.has("comment"))
7124      res.setCommentElement(parseString(json.get("comment").getAsString()));
7125    if (json.has("_comment"))
7126      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
7127  }
7128
7129  protected DetectedIssue parseDetectedIssue(JsonObject json) throws IOException, FHIRFormatError {
7130    DetectedIssue res = new DetectedIssue();
7131    parseDetectedIssueProperties(json, res);
7132    return res;
7133  }
7134
7135  protected void parseDetectedIssueProperties(JsonObject json, DetectedIssue res) throws IOException, FHIRFormatError {
7136    parseDomainResourceProperties(json, res);
7137    if (json.has("identifier"))
7138      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
7139    if (json.has("status"))
7140      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DetectedIssue.DetectedIssueStatus.NULL, new DetectedIssue.DetectedIssueStatusEnumFactory()));
7141    if (json.has("_status"))
7142      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
7143    if (json.has("category"))
7144      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
7145    if (json.has("severity"))
7146      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), DetectedIssue.DetectedIssueSeverity.NULL, new DetectedIssue.DetectedIssueSeverityEnumFactory()));
7147    if (json.has("_severity"))
7148      parseElementProperties(getJObject(json, "_severity"), res.getSeverityElement());
7149    if (json.has("patient"))
7150      res.setPatient(parseReference(getJObject(json, "patient")));
7151    if (json.has("date"))
7152      res.setDateElement(parseDateTime(json.get("date").getAsString()));
7153    if (json.has("_date"))
7154      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
7155    if (json.has("author"))
7156      res.setAuthor(parseReference(getJObject(json, "author")));
7157    if (json.has("implicated")) {
7158      JsonArray array = json.getAsJsonArray("implicated");
7159      for (int i = 0; i < array.size(); i++) {
7160        res.getImplicated().add(parseReference(array.get(i).getAsJsonObject()));
7161      }
7162    };
7163    if (json.has("detail"))
7164      res.setDetailElement(parseString(json.get("detail").getAsString()));
7165    if (json.has("_detail"))
7166      parseElementProperties(getJObject(json, "_detail"), res.getDetailElement());
7167    if (json.has("reference"))
7168      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
7169    if (json.has("_reference"))
7170      parseElementProperties(getJObject(json, "_reference"), res.getReferenceElement());
7171    if (json.has("mitigation")) {
7172      JsonArray array = json.getAsJsonArray("mitigation");
7173      for (int i = 0; i < array.size(); i++) {
7174        res.getMitigation().add(parseDetectedIssueDetectedIssueMitigationComponent(array.get(i).getAsJsonObject(), res));
7175      }
7176    };
7177  }
7178
7179  protected DetectedIssue.DetectedIssueMitigationComponent parseDetectedIssueDetectedIssueMitigationComponent(JsonObject json, DetectedIssue owner) throws IOException, FHIRFormatError {
7180    DetectedIssue.DetectedIssueMitigationComponent res = new DetectedIssue.DetectedIssueMitigationComponent();
7181    parseDetectedIssueDetectedIssueMitigationComponentProperties(json, owner, res);
7182    return res;
7183  }
7184
7185  protected void parseDetectedIssueDetectedIssueMitigationComponentProperties(JsonObject json, DetectedIssue owner, DetectedIssue.DetectedIssueMitigationComponent res) throws IOException, FHIRFormatError {
7186    parseBackboneProperties(json, res);
7187    if (json.has("action"))
7188      res.setAction(parseCodeableConcept(getJObject(json, "action")));
7189    if (json.has("date"))
7190      res.setDateElement(parseDateTime(json.get("date").getAsString()));
7191    if (json.has("_date"))
7192      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
7193    if (json.has("author"))
7194      res.setAuthor(parseReference(getJObject(json, "author")));
7195  }
7196
7197  protected Device parseDevice(JsonObject json) throws IOException, FHIRFormatError {
7198    Device res = new Device();
7199    parseDeviceProperties(json, res);
7200    return res;
7201  }
7202
7203  protected void parseDeviceProperties(JsonObject json, Device res) throws IOException, FHIRFormatError {
7204    parseDomainResourceProperties(json, res);
7205    if (json.has("identifier")) {
7206      JsonArray array = json.getAsJsonArray("identifier");
7207      for (int i = 0; i < array.size(); i++) {
7208        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7209      }
7210    };
7211    if (json.has("udi"))
7212      res.setUdi(parseDeviceDeviceUdiComponent(getJObject(json, "udi"), res));
7213    if (json.has("status"))
7214      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Device.FHIRDeviceStatus.NULL, new Device.FHIRDeviceStatusEnumFactory()));
7215    if (json.has("_status"))
7216      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
7217    if (json.has("type"))
7218      res.setType(parseCodeableConcept(getJObject(json, "type")));
7219    if (json.has("lotNumber"))
7220      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
7221    if (json.has("_lotNumber"))
7222      parseElementProperties(getJObject(json, "_lotNumber"), res.getLotNumberElement());
7223    if (json.has("manufacturer"))
7224      res.setManufacturerElement(parseString(json.get("manufacturer").getAsString()));
7225    if (json.has("_manufacturer"))
7226      parseElementProperties(getJObject(json, "_manufacturer"), res.getManufacturerElement());
7227    if (json.has("manufactureDate"))
7228      res.setManufactureDateElement(parseDateTime(json.get("manufactureDate").getAsString()));
7229    if (json.has("_manufactureDate"))
7230      parseElementProperties(getJObject(json, "_manufactureDate"), res.getManufactureDateElement());
7231    if (json.has("expirationDate"))
7232      res.setExpirationDateElement(parseDateTime(json.get("expirationDate").getAsString()));
7233    if (json.has("_expirationDate"))
7234      parseElementProperties(getJObject(json, "_expirationDate"), res.getExpirationDateElement());
7235    if (json.has("model"))
7236      res.setModelElement(parseString(json.get("model").getAsString()));
7237    if (json.has("_model"))
7238      parseElementProperties(getJObject(json, "_model"), res.getModelElement());
7239    if (json.has("version"))
7240      res.setVersionElement(parseString(json.get("version").getAsString()));
7241    if (json.has("_version"))
7242      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
7243    if (json.has("patient"))
7244      res.setPatient(parseReference(getJObject(json, "patient")));
7245    if (json.has("owner"))
7246      res.setOwner(parseReference(getJObject(json, "owner")));
7247    if (json.has("contact")) {
7248      JsonArray array = json.getAsJsonArray("contact");
7249      for (int i = 0; i < array.size(); i++) {
7250        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
7251      }
7252    };
7253    if (json.has("location"))
7254      res.setLocation(parseReference(getJObject(json, "location")));
7255    if (json.has("url"))
7256      res.setUrlElement(parseUri(json.get("url").getAsString()));
7257    if (json.has("_url"))
7258      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
7259    if (json.has("note")) {
7260      JsonArray array = json.getAsJsonArray("note");
7261      for (int i = 0; i < array.size(); i++) {
7262        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
7263      }
7264    };
7265    if (json.has("safety")) {
7266      JsonArray array = json.getAsJsonArray("safety");
7267      for (int i = 0; i < array.size(); i++) {
7268        res.getSafety().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7269      }
7270    };
7271  }
7272
7273  protected Device.DeviceUdiComponent parseDeviceDeviceUdiComponent(JsonObject json, Device owner) throws IOException, FHIRFormatError {
7274    Device.DeviceUdiComponent res = new Device.DeviceUdiComponent();
7275    parseDeviceDeviceUdiComponentProperties(json, owner, res);
7276    return res;
7277  }
7278
7279  protected void parseDeviceDeviceUdiComponentProperties(JsonObject json, Device owner, Device.DeviceUdiComponent res) throws IOException, FHIRFormatError {
7280    parseBackboneProperties(json, res);
7281    if (json.has("deviceIdentifier"))
7282      res.setDeviceIdentifierElement(parseString(json.get("deviceIdentifier").getAsString()));
7283    if (json.has("_deviceIdentifier"))
7284      parseElementProperties(getJObject(json, "_deviceIdentifier"), res.getDeviceIdentifierElement());
7285    if (json.has("name"))
7286      res.setNameElement(parseString(json.get("name").getAsString()));
7287    if (json.has("_name"))
7288      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
7289    if (json.has("jurisdiction"))
7290      res.setJurisdictionElement(parseUri(json.get("jurisdiction").getAsString()));
7291    if (json.has("_jurisdiction"))
7292      parseElementProperties(getJObject(json, "_jurisdiction"), res.getJurisdictionElement());
7293    if (json.has("carrierHRF"))
7294      res.setCarrierHRFElement(parseString(json.get("carrierHRF").getAsString()));
7295    if (json.has("_carrierHRF"))
7296      parseElementProperties(getJObject(json, "_carrierHRF"), res.getCarrierHRFElement());
7297    if (json.has("carrierAIDC"))
7298      res.setCarrierAIDCElement(parseBase64Binary(json.get("carrierAIDC").getAsString()));
7299    if (json.has("_carrierAIDC"))
7300      parseElementProperties(getJObject(json, "_carrierAIDC"), res.getCarrierAIDCElement());
7301    if (json.has("issuer"))
7302      res.setIssuerElement(parseUri(json.get("issuer").getAsString()));
7303    if (json.has("_issuer"))
7304      parseElementProperties(getJObject(json, "_issuer"), res.getIssuerElement());
7305    if (json.has("entryType"))
7306      res.setEntryTypeElement(parseEnumeration(json.get("entryType").getAsString(), Device.UDIEntryType.NULL, new Device.UDIEntryTypeEnumFactory()));
7307    if (json.has("_entryType"))
7308      parseElementProperties(getJObject(json, "_entryType"), res.getEntryTypeElement());
7309  }
7310
7311  protected DeviceComponent parseDeviceComponent(JsonObject json) throws IOException, FHIRFormatError {
7312    DeviceComponent res = new DeviceComponent();
7313    parseDeviceComponentProperties(json, res);
7314    return res;
7315  }
7316
7317  protected void parseDeviceComponentProperties(JsonObject json, DeviceComponent res) throws IOException, FHIRFormatError {
7318    parseDomainResourceProperties(json, res);
7319    if (json.has("identifier"))
7320      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
7321    if (json.has("type"))
7322      res.setType(parseCodeableConcept(getJObject(json, "type")));
7323    if (json.has("lastSystemChange"))
7324      res.setLastSystemChangeElement(parseInstant(json.get("lastSystemChange").getAsString()));
7325    if (json.has("_lastSystemChange"))
7326      parseElementProperties(getJObject(json, "_lastSystemChange"), res.getLastSystemChangeElement());
7327    if (json.has("source"))
7328      res.setSource(parseReference(getJObject(json, "source")));
7329    if (json.has("parent"))
7330      res.setParent(parseReference(getJObject(json, "parent")));
7331    if (json.has("operationalStatus")) {
7332      JsonArray array = json.getAsJsonArray("operationalStatus");
7333      for (int i = 0; i < array.size(); i++) {
7334        res.getOperationalStatus().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7335      }
7336    };
7337    if (json.has("parameterGroup"))
7338      res.setParameterGroup(parseCodeableConcept(getJObject(json, "parameterGroup")));
7339    if (json.has("measurementPrinciple"))
7340      res.setMeasurementPrincipleElement(parseEnumeration(json.get("measurementPrinciple").getAsString(), DeviceComponent.MeasmntPrinciple.NULL, new DeviceComponent.MeasmntPrincipleEnumFactory()));
7341    if (json.has("_measurementPrinciple"))
7342      parseElementProperties(getJObject(json, "_measurementPrinciple"), res.getMeasurementPrincipleElement());
7343    if (json.has("productionSpecification")) {
7344      JsonArray array = json.getAsJsonArray("productionSpecification");
7345      for (int i = 0; i < array.size(); i++) {
7346        res.getProductionSpecification().add(parseDeviceComponentDeviceComponentProductionSpecificationComponent(array.get(i).getAsJsonObject(), res));
7347      }
7348    };
7349    if (json.has("languageCode"))
7350      res.setLanguageCode(parseCodeableConcept(getJObject(json, "languageCode")));
7351  }
7352
7353  protected DeviceComponent.DeviceComponentProductionSpecificationComponent parseDeviceComponentDeviceComponentProductionSpecificationComponent(JsonObject json, DeviceComponent owner) throws IOException, FHIRFormatError {
7354    DeviceComponent.DeviceComponentProductionSpecificationComponent res = new DeviceComponent.DeviceComponentProductionSpecificationComponent();
7355    parseDeviceComponentDeviceComponentProductionSpecificationComponentProperties(json, owner, res);
7356    return res;
7357  }
7358
7359  protected void parseDeviceComponentDeviceComponentProductionSpecificationComponentProperties(JsonObject json, DeviceComponent owner, DeviceComponent.DeviceComponentProductionSpecificationComponent res) throws IOException, FHIRFormatError {
7360    parseBackboneProperties(json, res);
7361    if (json.has("specType"))
7362      res.setSpecType(parseCodeableConcept(getJObject(json, "specType")));
7363    if (json.has("componentId"))
7364      res.setComponentId(parseIdentifier(getJObject(json, "componentId")));
7365    if (json.has("productionSpec"))
7366      res.setProductionSpecElement(parseString(json.get("productionSpec").getAsString()));
7367    if (json.has("_productionSpec"))
7368      parseElementProperties(getJObject(json, "_productionSpec"), res.getProductionSpecElement());
7369  }
7370
7371  protected DeviceMetric parseDeviceMetric(JsonObject json) throws IOException, FHIRFormatError {
7372    DeviceMetric res = new DeviceMetric();
7373    parseDeviceMetricProperties(json, res);
7374    return res;
7375  }
7376
7377  protected void parseDeviceMetricProperties(JsonObject json, DeviceMetric res) throws IOException, FHIRFormatError {
7378    parseDomainResourceProperties(json, res);
7379    if (json.has("identifier"))
7380      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
7381    if (json.has("type"))
7382      res.setType(parseCodeableConcept(getJObject(json, "type")));
7383    if (json.has("unit"))
7384      res.setUnit(parseCodeableConcept(getJObject(json, "unit")));
7385    if (json.has("source"))
7386      res.setSource(parseReference(getJObject(json, "source")));
7387    if (json.has("parent"))
7388      res.setParent(parseReference(getJObject(json, "parent")));
7389    if (json.has("operationalStatus"))
7390      res.setOperationalStatusElement(parseEnumeration(json.get("operationalStatus").getAsString(), DeviceMetric.DeviceMetricOperationalStatus.NULL, new DeviceMetric.DeviceMetricOperationalStatusEnumFactory()));
7391    if (json.has("_operationalStatus"))
7392      parseElementProperties(getJObject(json, "_operationalStatus"), res.getOperationalStatusElement());
7393    if (json.has("color"))
7394      res.setColorElement(parseEnumeration(json.get("color").getAsString(), DeviceMetric.DeviceMetricColor.NULL, new DeviceMetric.DeviceMetricColorEnumFactory()));
7395    if (json.has("_color"))
7396      parseElementProperties(getJObject(json, "_color"), res.getColorElement());
7397    if (json.has("category"))
7398      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), DeviceMetric.DeviceMetricCategory.NULL, new DeviceMetric.DeviceMetricCategoryEnumFactory()));
7399    if (json.has("_category"))
7400      parseElementProperties(getJObject(json, "_category"), res.getCategoryElement());
7401    if (json.has("measurementPeriod"))
7402      res.setMeasurementPeriod(parseTiming(getJObject(json, "measurementPeriod")));
7403    if (json.has("calibration")) {
7404      JsonArray array = json.getAsJsonArray("calibration");
7405      for (int i = 0; i < array.size(); i++) {
7406        res.getCalibration().add(parseDeviceMetricDeviceMetricCalibrationComponent(array.get(i).getAsJsonObject(), res));
7407      }
7408    };
7409  }
7410
7411  protected DeviceMetric.DeviceMetricCalibrationComponent parseDeviceMetricDeviceMetricCalibrationComponent(JsonObject json, DeviceMetric owner) throws IOException, FHIRFormatError {
7412    DeviceMetric.DeviceMetricCalibrationComponent res = new DeviceMetric.DeviceMetricCalibrationComponent();
7413    parseDeviceMetricDeviceMetricCalibrationComponentProperties(json, owner, res);
7414    return res;
7415  }
7416
7417  protected void parseDeviceMetricDeviceMetricCalibrationComponentProperties(JsonObject json, DeviceMetric owner, DeviceMetric.DeviceMetricCalibrationComponent res) throws IOException, FHIRFormatError {
7418    parseBackboneProperties(json, res);
7419    if (json.has("type"))
7420      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), DeviceMetric.DeviceMetricCalibrationType.NULL, new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory()));
7421    if (json.has("_type"))
7422      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
7423    if (json.has("state"))
7424      res.setStateElement(parseEnumeration(json.get("state").getAsString(), DeviceMetric.DeviceMetricCalibrationState.NULL, new DeviceMetric.DeviceMetricCalibrationStateEnumFactory()));
7425    if (json.has("_state"))
7426      parseElementProperties(getJObject(json, "_state"), res.getStateElement());
7427    if (json.has("time"))
7428      res.setTimeElement(parseInstant(json.get("time").getAsString()));
7429    if (json.has("_time"))
7430      parseElementProperties(getJObject(json, "_time"), res.getTimeElement());
7431  }
7432
7433  protected DeviceRequest parseDeviceRequest(JsonObject json) throws IOException, FHIRFormatError {
7434    DeviceRequest res = new DeviceRequest();
7435    parseDeviceRequestProperties(json, res);
7436    return res;
7437  }
7438
7439  protected void parseDeviceRequestProperties(JsonObject json, DeviceRequest res) throws IOException, FHIRFormatError {
7440    parseDomainResourceProperties(json, res);
7441    if (json.has("identifier")) {
7442      JsonArray array = json.getAsJsonArray("identifier");
7443      for (int i = 0; i < array.size(); i++) {
7444        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7445      }
7446    };
7447    if (json.has("definition")) {
7448      JsonArray array = json.getAsJsonArray("definition");
7449      for (int i = 0; i < array.size(); i++) {
7450        res.getDefinition().add(parseReference(array.get(i).getAsJsonObject()));
7451      }
7452    };
7453    if (json.has("basedOn")) {
7454      JsonArray array = json.getAsJsonArray("basedOn");
7455      for (int i = 0; i < array.size(); i++) {
7456        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
7457      }
7458    };
7459    if (json.has("priorRequest")) {
7460      JsonArray array = json.getAsJsonArray("priorRequest");
7461      for (int i = 0; i < array.size(); i++) {
7462        res.getPriorRequest().add(parseReference(array.get(i).getAsJsonObject()));
7463      }
7464    };
7465    if (json.has("groupIdentifier"))
7466      res.setGroupIdentifier(parseIdentifier(getJObject(json, "groupIdentifier")));
7467    if (json.has("status"))
7468      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DeviceRequest.DeviceRequestStatus.NULL, new DeviceRequest.DeviceRequestStatusEnumFactory()));
7469    if (json.has("_status"))
7470      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
7471    if (json.has("intent"))
7472      res.setIntent(parseCodeableConcept(getJObject(json, "intent")));
7473    if (json.has("priority"))
7474      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), DeviceRequest.RequestPriority.NULL, new DeviceRequest.RequestPriorityEnumFactory()));
7475    if (json.has("_priority"))
7476      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
7477    Type code = parseType("code", json);
7478    if (code != null)
7479      res.setCode(code);
7480    if (json.has("subject"))
7481      res.setSubject(parseReference(getJObject(json, "subject")));
7482    if (json.has("context"))
7483      res.setContext(parseReference(getJObject(json, "context")));
7484    Type occurrence = parseType("occurrence", json);
7485    if (occurrence != null)
7486      res.setOccurrence(occurrence);
7487    if (json.has("authoredOn"))
7488      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
7489    if (json.has("_authoredOn"))
7490      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
7491    if (json.has("requester"))
7492      res.setRequester(parseDeviceRequestDeviceRequestRequesterComponent(getJObject(json, "requester"), res));
7493    if (json.has("performerType"))
7494      res.setPerformerType(parseCodeableConcept(getJObject(json, "performerType")));
7495    if (json.has("performer"))
7496      res.setPerformer(parseReference(getJObject(json, "performer")));
7497    if (json.has("reasonCode")) {
7498      JsonArray array = json.getAsJsonArray("reasonCode");
7499      for (int i = 0; i < array.size(); i++) {
7500        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7501      }
7502    };
7503    if (json.has("reasonReference")) {
7504      JsonArray array = json.getAsJsonArray("reasonReference");
7505      for (int i = 0; i < array.size(); i++) {
7506        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
7507      }
7508    };
7509    if (json.has("supportingInfo")) {
7510      JsonArray array = json.getAsJsonArray("supportingInfo");
7511      for (int i = 0; i < array.size(); i++) {
7512        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
7513      }
7514    };
7515    if (json.has("note")) {
7516      JsonArray array = json.getAsJsonArray("note");
7517      for (int i = 0; i < array.size(); i++) {
7518        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
7519      }
7520    };
7521    if (json.has("relevantHistory")) {
7522      JsonArray array = json.getAsJsonArray("relevantHistory");
7523      for (int i = 0; i < array.size(); i++) {
7524        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
7525      }
7526    };
7527  }
7528
7529  protected DeviceRequest.DeviceRequestRequesterComponent parseDeviceRequestDeviceRequestRequesterComponent(JsonObject json, DeviceRequest owner) throws IOException, FHIRFormatError {
7530    DeviceRequest.DeviceRequestRequesterComponent res = new DeviceRequest.DeviceRequestRequesterComponent();
7531    parseDeviceRequestDeviceRequestRequesterComponentProperties(json, owner, res);
7532    return res;
7533  }
7534
7535  protected void parseDeviceRequestDeviceRequestRequesterComponentProperties(JsonObject json, DeviceRequest owner, DeviceRequest.DeviceRequestRequesterComponent res) throws IOException, FHIRFormatError {
7536    parseBackboneProperties(json, res);
7537    if (json.has("agent"))
7538      res.setAgent(parseReference(getJObject(json, "agent")));
7539    if (json.has("onBehalfOf"))
7540      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
7541  }
7542
7543  protected DeviceUseStatement parseDeviceUseStatement(JsonObject json) throws IOException, FHIRFormatError {
7544    DeviceUseStatement res = new DeviceUseStatement();
7545    parseDeviceUseStatementProperties(json, res);
7546    return res;
7547  }
7548
7549  protected void parseDeviceUseStatementProperties(JsonObject json, DeviceUseStatement res) throws IOException, FHIRFormatError {
7550    parseDomainResourceProperties(json, res);
7551    if (json.has("identifier")) {
7552      JsonArray array = json.getAsJsonArray("identifier");
7553      for (int i = 0; i < array.size(); i++) {
7554        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7555      }
7556    };
7557    if (json.has("status"))
7558      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DeviceUseStatement.DeviceUseStatementStatus.NULL, new DeviceUseStatement.DeviceUseStatementStatusEnumFactory()));
7559    if (json.has("_status"))
7560      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
7561    if (json.has("subject"))
7562      res.setSubject(parseReference(getJObject(json, "subject")));
7563    if (json.has("whenUsed"))
7564      res.setWhenUsed(parsePeriod(getJObject(json, "whenUsed")));
7565    Type timing = parseType("timing", json);
7566    if (timing != null)
7567      res.setTiming(timing);
7568    if (json.has("recordedOn"))
7569      res.setRecordedOnElement(parseDateTime(json.get("recordedOn").getAsString()));
7570    if (json.has("_recordedOn"))
7571      parseElementProperties(getJObject(json, "_recordedOn"), res.getRecordedOnElement());
7572    if (json.has("source"))
7573      res.setSource(parseReference(getJObject(json, "source")));
7574    if (json.has("device"))
7575      res.setDevice(parseReference(getJObject(json, "device")));
7576    if (json.has("indication")) {
7577      JsonArray array = json.getAsJsonArray("indication");
7578      for (int i = 0; i < array.size(); i++) {
7579        res.getIndication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7580      }
7581    };
7582    if (json.has("bodySite"))
7583      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
7584    if (json.has("note")) {
7585      JsonArray array = json.getAsJsonArray("note");
7586      for (int i = 0; i < array.size(); i++) {
7587        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
7588      }
7589    };
7590  }
7591
7592  protected DiagnosticReport parseDiagnosticReport(JsonObject json) throws IOException, FHIRFormatError {
7593    DiagnosticReport res = new DiagnosticReport();
7594    parseDiagnosticReportProperties(json, res);
7595    return res;
7596  }
7597
7598  protected void parseDiagnosticReportProperties(JsonObject json, DiagnosticReport res) throws IOException, FHIRFormatError {
7599    parseDomainResourceProperties(json, res);
7600    if (json.has("identifier")) {
7601      JsonArray array = json.getAsJsonArray("identifier");
7602      for (int i = 0; i < array.size(); i++) {
7603        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7604      }
7605    };
7606    if (json.has("basedOn")) {
7607      JsonArray array = json.getAsJsonArray("basedOn");
7608      for (int i = 0; i < array.size(); i++) {
7609        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
7610      }
7611    };
7612    if (json.has("status"))
7613      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DiagnosticReport.DiagnosticReportStatus.NULL, new DiagnosticReport.DiagnosticReportStatusEnumFactory()));
7614    if (json.has("_status"))
7615      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
7616    if (json.has("category"))
7617      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
7618    if (json.has("code"))
7619      res.setCode(parseCodeableConcept(getJObject(json, "code")));
7620    if (json.has("subject"))
7621      res.setSubject(parseReference(getJObject(json, "subject")));
7622    if (json.has("context"))
7623      res.setContext(parseReference(getJObject(json, "context")));
7624    Type effective = parseType("effective", json);
7625    if (effective != null)
7626      res.setEffective(effective);
7627    if (json.has("issued"))
7628      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
7629    if (json.has("_issued"))
7630      parseElementProperties(getJObject(json, "_issued"), res.getIssuedElement());
7631    if (json.has("performer")) {
7632      JsonArray array = json.getAsJsonArray("performer");
7633      for (int i = 0; i < array.size(); i++) {
7634        res.getPerformer().add(parseDiagnosticReportDiagnosticReportPerformerComponent(array.get(i).getAsJsonObject(), res));
7635      }
7636    };
7637    if (json.has("specimen")) {
7638      JsonArray array = json.getAsJsonArray("specimen");
7639      for (int i = 0; i < array.size(); i++) {
7640        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
7641      }
7642    };
7643    if (json.has("result")) {
7644      JsonArray array = json.getAsJsonArray("result");
7645      for (int i = 0; i < array.size(); i++) {
7646        res.getResult().add(parseReference(array.get(i).getAsJsonObject()));
7647      }
7648    };
7649    if (json.has("imagingStudy")) {
7650      JsonArray array = json.getAsJsonArray("imagingStudy");
7651      for (int i = 0; i < array.size(); i++) {
7652        res.getImagingStudy().add(parseReference(array.get(i).getAsJsonObject()));
7653      }
7654    };
7655    if (json.has("image")) {
7656      JsonArray array = json.getAsJsonArray("image");
7657      for (int i = 0; i < array.size(); i++) {
7658        res.getImage().add(parseDiagnosticReportDiagnosticReportImageComponent(array.get(i).getAsJsonObject(), res));
7659      }
7660    };
7661    if (json.has("conclusion"))
7662      res.setConclusionElement(parseString(json.get("conclusion").getAsString()));
7663    if (json.has("_conclusion"))
7664      parseElementProperties(getJObject(json, "_conclusion"), res.getConclusionElement());
7665    if (json.has("codedDiagnosis")) {
7666      JsonArray array = json.getAsJsonArray("codedDiagnosis");
7667      for (int i = 0; i < array.size(); i++) {
7668        res.getCodedDiagnosis().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7669      }
7670    };
7671    if (json.has("presentedForm")) {
7672      JsonArray array = json.getAsJsonArray("presentedForm");
7673      for (int i = 0; i < array.size(); i++) {
7674        res.getPresentedForm().add(parseAttachment(array.get(i).getAsJsonObject()));
7675      }
7676    };
7677  }
7678
7679  protected DiagnosticReport.DiagnosticReportPerformerComponent parseDiagnosticReportDiagnosticReportPerformerComponent(JsonObject json, DiagnosticReport owner) throws IOException, FHIRFormatError {
7680    DiagnosticReport.DiagnosticReportPerformerComponent res = new DiagnosticReport.DiagnosticReportPerformerComponent();
7681    parseDiagnosticReportDiagnosticReportPerformerComponentProperties(json, owner, res);
7682    return res;
7683  }
7684
7685  protected void parseDiagnosticReportDiagnosticReportPerformerComponentProperties(JsonObject json, DiagnosticReport owner, DiagnosticReport.DiagnosticReportPerformerComponent res) throws IOException, FHIRFormatError {
7686    parseBackboneProperties(json, res);
7687    if (json.has("role"))
7688      res.setRole(parseCodeableConcept(getJObject(json, "role")));
7689    if (json.has("actor"))
7690      res.setActor(parseReference(getJObject(json, "actor")));
7691  }
7692
7693  protected DiagnosticReport.DiagnosticReportImageComponent parseDiagnosticReportDiagnosticReportImageComponent(JsonObject json, DiagnosticReport owner) throws IOException, FHIRFormatError {
7694    DiagnosticReport.DiagnosticReportImageComponent res = new DiagnosticReport.DiagnosticReportImageComponent();
7695    parseDiagnosticReportDiagnosticReportImageComponentProperties(json, owner, res);
7696    return res;
7697  }
7698
7699  protected void parseDiagnosticReportDiagnosticReportImageComponentProperties(JsonObject json, DiagnosticReport owner, DiagnosticReport.DiagnosticReportImageComponent res) throws IOException, FHIRFormatError {
7700    parseBackboneProperties(json, res);
7701    if (json.has("comment"))
7702      res.setCommentElement(parseString(json.get("comment").getAsString()));
7703    if (json.has("_comment"))
7704      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
7705    if (json.has("link"))
7706      res.setLink(parseReference(getJObject(json, "link")));
7707  }
7708
7709  protected DocumentManifest parseDocumentManifest(JsonObject json) throws IOException, FHIRFormatError {
7710    DocumentManifest res = new DocumentManifest();
7711    parseDocumentManifestProperties(json, res);
7712    return res;
7713  }
7714
7715  protected void parseDocumentManifestProperties(JsonObject json, DocumentManifest res) throws IOException, FHIRFormatError {
7716    parseDomainResourceProperties(json, res);
7717    if (json.has("masterIdentifier"))
7718      res.setMasterIdentifier(parseIdentifier(getJObject(json, "masterIdentifier")));
7719    if (json.has("identifier")) {
7720      JsonArray array = json.getAsJsonArray("identifier");
7721      for (int i = 0; i < array.size(); i++) {
7722        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7723      }
7724    };
7725    if (json.has("status"))
7726      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.DocumentReferenceStatus.NULL, new Enumerations.DocumentReferenceStatusEnumFactory()));
7727    if (json.has("_status"))
7728      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
7729    if (json.has("type"))
7730      res.setType(parseCodeableConcept(getJObject(json, "type")));
7731    if (json.has("subject"))
7732      res.setSubject(parseReference(getJObject(json, "subject")));
7733    if (json.has("created"))
7734      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
7735    if (json.has("_created"))
7736      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
7737    if (json.has("author")) {
7738      JsonArray array = json.getAsJsonArray("author");
7739      for (int i = 0; i < array.size(); i++) {
7740        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
7741      }
7742    };
7743    if (json.has("recipient")) {
7744      JsonArray array = json.getAsJsonArray("recipient");
7745      for (int i = 0; i < array.size(); i++) {
7746        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
7747      }
7748    };
7749    if (json.has("source"))
7750      res.setSourceElement(parseUri(json.get("source").getAsString()));
7751    if (json.has("_source"))
7752      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
7753    if (json.has("description"))
7754      res.setDescriptionElement(parseString(json.get("description").getAsString()));
7755    if (json.has("_description"))
7756      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
7757    if (json.has("content")) {
7758      JsonArray array = json.getAsJsonArray("content");
7759      for (int i = 0; i < array.size(); i++) {
7760        res.getContent().add(parseDocumentManifestDocumentManifestContentComponent(array.get(i).getAsJsonObject(), res));
7761      }
7762    };
7763    if (json.has("related")) {
7764      JsonArray array = json.getAsJsonArray("related");
7765      for (int i = 0; i < array.size(); i++) {
7766        res.getRelated().add(parseDocumentManifestDocumentManifestRelatedComponent(array.get(i).getAsJsonObject(), res));
7767      }
7768    };
7769  }
7770
7771  protected DocumentManifest.DocumentManifestContentComponent parseDocumentManifestDocumentManifestContentComponent(JsonObject json, DocumentManifest owner) throws IOException, FHIRFormatError {
7772    DocumentManifest.DocumentManifestContentComponent res = new DocumentManifest.DocumentManifestContentComponent();
7773    parseDocumentManifestDocumentManifestContentComponentProperties(json, owner, res);
7774    return res;
7775  }
7776
7777  protected void parseDocumentManifestDocumentManifestContentComponentProperties(JsonObject json, DocumentManifest owner, DocumentManifest.DocumentManifestContentComponent res) throws IOException, FHIRFormatError {
7778    parseBackboneProperties(json, res);
7779    Type p = parseType("p", json);
7780    if (p != null)
7781      res.setP(p);
7782  }
7783
7784  protected DocumentManifest.DocumentManifestRelatedComponent parseDocumentManifestDocumentManifestRelatedComponent(JsonObject json, DocumentManifest owner) throws IOException, FHIRFormatError {
7785    DocumentManifest.DocumentManifestRelatedComponent res = new DocumentManifest.DocumentManifestRelatedComponent();
7786    parseDocumentManifestDocumentManifestRelatedComponentProperties(json, owner, res);
7787    return res;
7788  }
7789
7790  protected void parseDocumentManifestDocumentManifestRelatedComponentProperties(JsonObject json, DocumentManifest owner, DocumentManifest.DocumentManifestRelatedComponent res) throws IOException, FHIRFormatError {
7791    parseBackboneProperties(json, res);
7792    if (json.has("identifier"))
7793      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
7794    if (json.has("ref"))
7795      res.setRef(parseReference(getJObject(json, "ref")));
7796  }
7797
7798  protected DocumentReference parseDocumentReference(JsonObject json) throws IOException, FHIRFormatError {
7799    DocumentReference res = new DocumentReference();
7800    parseDocumentReferenceProperties(json, res);
7801    return res;
7802  }
7803
7804  protected void parseDocumentReferenceProperties(JsonObject json, DocumentReference res) throws IOException, FHIRFormatError {
7805    parseDomainResourceProperties(json, res);
7806    if (json.has("masterIdentifier"))
7807      res.setMasterIdentifier(parseIdentifier(getJObject(json, "masterIdentifier")));
7808    if (json.has("identifier")) {
7809      JsonArray array = json.getAsJsonArray("identifier");
7810      for (int i = 0; i < array.size(); i++) {
7811        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7812      }
7813    };
7814    if (json.has("status"))
7815      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.DocumentReferenceStatus.NULL, new Enumerations.DocumentReferenceStatusEnumFactory()));
7816    if (json.has("_status"))
7817      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
7818    if (json.has("docStatus"))
7819      res.setDocStatusElement(parseEnumeration(json.get("docStatus").getAsString(), DocumentReference.ReferredDocumentStatus.NULL, new DocumentReference.ReferredDocumentStatusEnumFactory()));
7820    if (json.has("_docStatus"))
7821      parseElementProperties(getJObject(json, "_docStatus"), res.getDocStatusElement());
7822    if (json.has("type"))
7823      res.setType(parseCodeableConcept(getJObject(json, "type")));
7824    if (json.has("class"))
7825      res.setClass_(parseCodeableConcept(getJObject(json, "class")));
7826    if (json.has("subject"))
7827      res.setSubject(parseReference(getJObject(json, "subject")));
7828    if (json.has("created"))
7829      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
7830    if (json.has("_created"))
7831      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
7832    if (json.has("indexed"))
7833      res.setIndexedElement(parseInstant(json.get("indexed").getAsString()));
7834    if (json.has("_indexed"))
7835      parseElementProperties(getJObject(json, "_indexed"), res.getIndexedElement());
7836    if (json.has("author")) {
7837      JsonArray array = json.getAsJsonArray("author");
7838      for (int i = 0; i < array.size(); i++) {
7839        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
7840      }
7841    };
7842    if (json.has("authenticator"))
7843      res.setAuthenticator(parseReference(getJObject(json, "authenticator")));
7844    if (json.has("custodian"))
7845      res.setCustodian(parseReference(getJObject(json, "custodian")));
7846    if (json.has("relatesTo")) {
7847      JsonArray array = json.getAsJsonArray("relatesTo");
7848      for (int i = 0; i < array.size(); i++) {
7849        res.getRelatesTo().add(parseDocumentReferenceDocumentReferenceRelatesToComponent(array.get(i).getAsJsonObject(), res));
7850      }
7851    };
7852    if (json.has("description"))
7853      res.setDescriptionElement(parseString(json.get("description").getAsString()));
7854    if (json.has("_description"))
7855      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
7856    if (json.has("securityLabel")) {
7857      JsonArray array = json.getAsJsonArray("securityLabel");
7858      for (int i = 0; i < array.size(); i++) {
7859        res.getSecurityLabel().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7860      }
7861    };
7862    if (json.has("content")) {
7863      JsonArray array = json.getAsJsonArray("content");
7864      for (int i = 0; i < array.size(); i++) {
7865        res.getContent().add(parseDocumentReferenceDocumentReferenceContentComponent(array.get(i).getAsJsonObject(), res));
7866      }
7867    };
7868    if (json.has("context"))
7869      res.setContext(parseDocumentReferenceDocumentReferenceContextComponent(getJObject(json, "context"), res));
7870  }
7871
7872  protected DocumentReference.DocumentReferenceRelatesToComponent parseDocumentReferenceDocumentReferenceRelatesToComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
7873    DocumentReference.DocumentReferenceRelatesToComponent res = new DocumentReference.DocumentReferenceRelatesToComponent();
7874    parseDocumentReferenceDocumentReferenceRelatesToComponentProperties(json, owner, res);
7875    return res;
7876  }
7877
7878  protected void parseDocumentReferenceDocumentReferenceRelatesToComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceRelatesToComponent res) throws IOException, FHIRFormatError {
7879    parseBackboneProperties(json, res);
7880    if (json.has("code"))
7881      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), DocumentReference.DocumentRelationshipType.NULL, new DocumentReference.DocumentRelationshipTypeEnumFactory()));
7882    if (json.has("_code"))
7883      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
7884    if (json.has("target"))
7885      res.setTarget(parseReference(getJObject(json, "target")));
7886  }
7887
7888  protected DocumentReference.DocumentReferenceContentComponent parseDocumentReferenceDocumentReferenceContentComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
7889    DocumentReference.DocumentReferenceContentComponent res = new DocumentReference.DocumentReferenceContentComponent();
7890    parseDocumentReferenceDocumentReferenceContentComponentProperties(json, owner, res);
7891    return res;
7892  }
7893
7894  protected void parseDocumentReferenceDocumentReferenceContentComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceContentComponent res) throws IOException, FHIRFormatError {
7895    parseBackboneProperties(json, res);
7896    if (json.has("attachment"))
7897      res.setAttachment(parseAttachment(getJObject(json, "attachment")));
7898    if (json.has("format"))
7899      res.setFormat(parseCoding(getJObject(json, "format")));
7900  }
7901
7902  protected DocumentReference.DocumentReferenceContextComponent parseDocumentReferenceDocumentReferenceContextComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
7903    DocumentReference.DocumentReferenceContextComponent res = new DocumentReference.DocumentReferenceContextComponent();
7904    parseDocumentReferenceDocumentReferenceContextComponentProperties(json, owner, res);
7905    return res;
7906  }
7907
7908  protected void parseDocumentReferenceDocumentReferenceContextComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceContextComponent res) throws IOException, FHIRFormatError {
7909    parseBackboneProperties(json, res);
7910    if (json.has("encounter"))
7911      res.setEncounter(parseReference(getJObject(json, "encounter")));
7912    if (json.has("event")) {
7913      JsonArray array = json.getAsJsonArray("event");
7914      for (int i = 0; i < array.size(); i++) {
7915        res.getEvent().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7916      }
7917    };
7918    if (json.has("period"))
7919      res.setPeriod(parsePeriod(getJObject(json, "period")));
7920    if (json.has("facilityType"))
7921      res.setFacilityType(parseCodeableConcept(getJObject(json, "facilityType")));
7922    if (json.has("practiceSetting"))
7923      res.setPracticeSetting(parseCodeableConcept(getJObject(json, "practiceSetting")));
7924    if (json.has("sourcePatientInfo"))
7925      res.setSourcePatientInfo(parseReference(getJObject(json, "sourcePatientInfo")));
7926    if (json.has("related")) {
7927      JsonArray array = json.getAsJsonArray("related");
7928      for (int i = 0; i < array.size(); i++) {
7929        res.getRelated().add(parseDocumentReferenceDocumentReferenceContextRelatedComponent(array.get(i).getAsJsonObject(), owner));
7930      }
7931    };
7932  }
7933
7934  protected DocumentReference.DocumentReferenceContextRelatedComponent parseDocumentReferenceDocumentReferenceContextRelatedComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
7935    DocumentReference.DocumentReferenceContextRelatedComponent res = new DocumentReference.DocumentReferenceContextRelatedComponent();
7936    parseDocumentReferenceDocumentReferenceContextRelatedComponentProperties(json, owner, res);
7937    return res;
7938  }
7939
7940  protected void parseDocumentReferenceDocumentReferenceContextRelatedComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceContextRelatedComponent res) throws IOException, FHIRFormatError {
7941    parseBackboneProperties(json, res);
7942    if (json.has("identifier"))
7943      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
7944    if (json.has("ref"))
7945      res.setRef(parseReference(getJObject(json, "ref")));
7946  }
7947
7948  protected EligibilityRequest parseEligibilityRequest(JsonObject json) throws IOException, FHIRFormatError {
7949    EligibilityRequest res = new EligibilityRequest();
7950    parseEligibilityRequestProperties(json, res);
7951    return res;
7952  }
7953
7954  protected void parseEligibilityRequestProperties(JsonObject json, EligibilityRequest res) throws IOException, FHIRFormatError {
7955    parseDomainResourceProperties(json, res);
7956    if (json.has("identifier")) {
7957      JsonArray array = json.getAsJsonArray("identifier");
7958      for (int i = 0; i < array.size(); i++) {
7959        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7960      }
7961    };
7962    if (json.has("status"))
7963      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EligibilityRequest.EligibilityRequestStatus.NULL, new EligibilityRequest.EligibilityRequestStatusEnumFactory()));
7964    if (json.has("_status"))
7965      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
7966    if (json.has("priority"))
7967      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
7968    if (json.has("patient"))
7969      res.setPatient(parseReference(getJObject(json, "patient")));
7970    Type serviced = parseType("serviced", json);
7971    if (serviced != null)
7972      res.setServiced(serviced);
7973    if (json.has("created"))
7974      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
7975    if (json.has("_created"))
7976      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
7977    if (json.has("enterer"))
7978      res.setEnterer(parseReference(getJObject(json, "enterer")));
7979    if (json.has("provider"))
7980      res.setProvider(parseReference(getJObject(json, "provider")));
7981    if (json.has("organization"))
7982      res.setOrganization(parseReference(getJObject(json, "organization")));
7983    if (json.has("insurer"))
7984      res.setInsurer(parseReference(getJObject(json, "insurer")));
7985    if (json.has("facility"))
7986      res.setFacility(parseReference(getJObject(json, "facility")));
7987    if (json.has("coverage"))
7988      res.setCoverage(parseReference(getJObject(json, "coverage")));
7989    if (json.has("businessArrangement"))
7990      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
7991    if (json.has("_businessArrangement"))
7992      parseElementProperties(getJObject(json, "_businessArrangement"), res.getBusinessArrangementElement());
7993    if (json.has("benefitCategory"))
7994      res.setBenefitCategory(parseCodeableConcept(getJObject(json, "benefitCategory")));
7995    if (json.has("benefitSubCategory"))
7996      res.setBenefitSubCategory(parseCodeableConcept(getJObject(json, "benefitSubCategory")));
7997  }
7998
7999  protected EligibilityResponse parseEligibilityResponse(JsonObject json) throws IOException, FHIRFormatError {
8000    EligibilityResponse res = new EligibilityResponse();
8001    parseEligibilityResponseProperties(json, res);
8002    return res;
8003  }
8004
8005  protected void parseEligibilityResponseProperties(JsonObject json, EligibilityResponse res) throws IOException, FHIRFormatError {
8006    parseDomainResourceProperties(json, res);
8007    if (json.has("identifier")) {
8008      JsonArray array = json.getAsJsonArray("identifier");
8009      for (int i = 0; i < array.size(); i++) {
8010        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8011      }
8012    };
8013    if (json.has("status"))
8014      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EligibilityResponse.EligibilityResponseStatus.NULL, new EligibilityResponse.EligibilityResponseStatusEnumFactory()));
8015    if (json.has("_status"))
8016      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8017    if (json.has("created"))
8018      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
8019    if (json.has("_created"))
8020      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
8021    if (json.has("requestProvider"))
8022      res.setRequestProvider(parseReference(getJObject(json, "requestProvider")));
8023    if (json.has("requestOrganization"))
8024      res.setRequestOrganization(parseReference(getJObject(json, "requestOrganization")));
8025    if (json.has("request"))
8026      res.setRequest(parseReference(getJObject(json, "request")));
8027    if (json.has("outcome"))
8028      res.setOutcome(parseCodeableConcept(getJObject(json, "outcome")));
8029    if (json.has("disposition"))
8030      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
8031    if (json.has("_disposition"))
8032      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
8033    if (json.has("insurer"))
8034      res.setInsurer(parseReference(getJObject(json, "insurer")));
8035    if (json.has("inforce"))
8036      res.setInforceElement(parseBoolean(json.get("inforce").getAsBoolean()));
8037    if (json.has("_inforce"))
8038      parseElementProperties(getJObject(json, "_inforce"), res.getInforceElement());
8039    if (json.has("insurance")) {
8040      JsonArray array = json.getAsJsonArray("insurance");
8041      for (int i = 0; i < array.size(); i++) {
8042        res.getInsurance().add(parseEligibilityResponseInsuranceComponent(array.get(i).getAsJsonObject(), res));
8043      }
8044    };
8045    if (json.has("form"))
8046      res.setForm(parseCodeableConcept(getJObject(json, "form")));
8047    if (json.has("error")) {
8048      JsonArray array = json.getAsJsonArray("error");
8049      for (int i = 0; i < array.size(); i++) {
8050        res.getError().add(parseEligibilityResponseErrorsComponent(array.get(i).getAsJsonObject(), res));
8051      }
8052    };
8053  }
8054
8055  protected EligibilityResponse.InsuranceComponent parseEligibilityResponseInsuranceComponent(JsonObject json, EligibilityResponse owner) throws IOException, FHIRFormatError {
8056    EligibilityResponse.InsuranceComponent res = new EligibilityResponse.InsuranceComponent();
8057    parseEligibilityResponseInsuranceComponentProperties(json, owner, res);
8058    return res;
8059  }
8060
8061  protected void parseEligibilityResponseInsuranceComponentProperties(JsonObject json, EligibilityResponse owner, EligibilityResponse.InsuranceComponent res) throws IOException, FHIRFormatError {
8062    parseBackboneProperties(json, res);
8063    if (json.has("coverage"))
8064      res.setCoverage(parseReference(getJObject(json, "coverage")));
8065    if (json.has("contract"))
8066      res.setContract(parseReference(getJObject(json, "contract")));
8067    if (json.has("benefitBalance")) {
8068      JsonArray array = json.getAsJsonArray("benefitBalance");
8069      for (int i = 0; i < array.size(); i++) {
8070        res.getBenefitBalance().add(parseEligibilityResponseBenefitsComponent(array.get(i).getAsJsonObject(), owner));
8071      }
8072    };
8073  }
8074
8075  protected EligibilityResponse.BenefitsComponent parseEligibilityResponseBenefitsComponent(JsonObject json, EligibilityResponse owner) throws IOException, FHIRFormatError {
8076    EligibilityResponse.BenefitsComponent res = new EligibilityResponse.BenefitsComponent();
8077    parseEligibilityResponseBenefitsComponentProperties(json, owner, res);
8078    return res;
8079  }
8080
8081  protected void parseEligibilityResponseBenefitsComponentProperties(JsonObject json, EligibilityResponse owner, EligibilityResponse.BenefitsComponent res) throws IOException, FHIRFormatError {
8082    parseBackboneProperties(json, res);
8083    if (json.has("category"))
8084      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
8085    if (json.has("subCategory"))
8086      res.setSubCategory(parseCodeableConcept(getJObject(json, "subCategory")));
8087    if (json.has("excluded"))
8088      res.setExcludedElement(parseBoolean(json.get("excluded").getAsBoolean()));
8089    if (json.has("_excluded"))
8090      parseElementProperties(getJObject(json, "_excluded"), res.getExcludedElement());
8091    if (json.has("name"))
8092      res.setNameElement(parseString(json.get("name").getAsString()));
8093    if (json.has("_name"))
8094      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
8095    if (json.has("description"))
8096      res.setDescriptionElement(parseString(json.get("description").getAsString()));
8097    if (json.has("_description"))
8098      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
8099    if (json.has("network"))
8100      res.setNetwork(parseCodeableConcept(getJObject(json, "network")));
8101    if (json.has("unit"))
8102      res.setUnit(parseCodeableConcept(getJObject(json, "unit")));
8103    if (json.has("term"))
8104      res.setTerm(parseCodeableConcept(getJObject(json, "term")));
8105    if (json.has("financial")) {
8106      JsonArray array = json.getAsJsonArray("financial");
8107      for (int i = 0; i < array.size(); i++) {
8108        res.getFinancial().add(parseEligibilityResponseBenefitComponent(array.get(i).getAsJsonObject(), owner));
8109      }
8110    };
8111  }
8112
8113  protected EligibilityResponse.BenefitComponent parseEligibilityResponseBenefitComponent(JsonObject json, EligibilityResponse owner) throws IOException, FHIRFormatError {
8114    EligibilityResponse.BenefitComponent res = new EligibilityResponse.BenefitComponent();
8115    parseEligibilityResponseBenefitComponentProperties(json, owner, res);
8116    return res;
8117  }
8118
8119  protected void parseEligibilityResponseBenefitComponentProperties(JsonObject json, EligibilityResponse owner, EligibilityResponse.BenefitComponent res) throws IOException, FHIRFormatError {
8120    parseBackboneProperties(json, res);
8121    if (json.has("type"))
8122      res.setType(parseCodeableConcept(getJObject(json, "type")));
8123    Type allowed = parseType("allowed", json);
8124    if (allowed != null)
8125      res.setAllowed(allowed);
8126    Type used = parseType("used", json);
8127    if (used != null)
8128      res.setUsed(used);
8129  }
8130
8131  protected EligibilityResponse.ErrorsComponent parseEligibilityResponseErrorsComponent(JsonObject json, EligibilityResponse owner) throws IOException, FHIRFormatError {
8132    EligibilityResponse.ErrorsComponent res = new EligibilityResponse.ErrorsComponent();
8133    parseEligibilityResponseErrorsComponentProperties(json, owner, res);
8134    return res;
8135  }
8136
8137  protected void parseEligibilityResponseErrorsComponentProperties(JsonObject json, EligibilityResponse owner, EligibilityResponse.ErrorsComponent res) throws IOException, FHIRFormatError {
8138    parseBackboneProperties(json, res);
8139    if (json.has("code"))
8140      res.setCode(parseCodeableConcept(getJObject(json, "code")));
8141  }
8142
8143  protected Encounter parseEncounter(JsonObject json) throws IOException, FHIRFormatError {
8144    Encounter res = new Encounter();
8145    parseEncounterProperties(json, res);
8146    return res;
8147  }
8148
8149  protected void parseEncounterProperties(JsonObject json, Encounter res) throws IOException, FHIRFormatError {
8150    parseDomainResourceProperties(json, res);
8151    if (json.has("identifier")) {
8152      JsonArray array = json.getAsJsonArray("identifier");
8153      for (int i = 0; i < array.size(); i++) {
8154        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8155      }
8156    };
8157    if (json.has("status"))
8158      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterStatus.NULL, new Encounter.EncounterStatusEnumFactory()));
8159    if (json.has("_status"))
8160      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8161    if (json.has("statusHistory")) {
8162      JsonArray array = json.getAsJsonArray("statusHistory");
8163      for (int i = 0; i < array.size(); i++) {
8164        res.getStatusHistory().add(parseEncounterStatusHistoryComponent(array.get(i).getAsJsonObject(), res));
8165      }
8166    };
8167    if (json.has("class"))
8168      res.setClass_(parseCoding(getJObject(json, "class")));
8169    if (json.has("classHistory")) {
8170      JsonArray array = json.getAsJsonArray("classHistory");
8171      for (int i = 0; i < array.size(); i++) {
8172        res.getClassHistory().add(parseEncounterClassHistoryComponent(array.get(i).getAsJsonObject(), res));
8173      }
8174    };
8175    if (json.has("type")) {
8176      JsonArray array = json.getAsJsonArray("type");
8177      for (int i = 0; i < array.size(); i++) {
8178        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8179      }
8180    };
8181    if (json.has("priority"))
8182      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
8183    if (json.has("subject"))
8184      res.setSubject(parseReference(getJObject(json, "subject")));
8185    if (json.has("episodeOfCare")) {
8186      JsonArray array = json.getAsJsonArray("episodeOfCare");
8187      for (int i = 0; i < array.size(); i++) {
8188        res.getEpisodeOfCare().add(parseReference(array.get(i).getAsJsonObject()));
8189      }
8190    };
8191    if (json.has("incomingReferral")) {
8192      JsonArray array = json.getAsJsonArray("incomingReferral");
8193      for (int i = 0; i < array.size(); i++) {
8194        res.getIncomingReferral().add(parseReference(array.get(i).getAsJsonObject()));
8195      }
8196    };
8197    if (json.has("participant")) {
8198      JsonArray array = json.getAsJsonArray("participant");
8199      for (int i = 0; i < array.size(); i++) {
8200        res.getParticipant().add(parseEncounterEncounterParticipantComponent(array.get(i).getAsJsonObject(), res));
8201      }
8202    };
8203    if (json.has("appointment"))
8204      res.setAppointment(parseReference(getJObject(json, "appointment")));
8205    if (json.has("period"))
8206      res.setPeriod(parsePeriod(getJObject(json, "period")));
8207    if (json.has("length"))
8208      res.setLength(parseDuration(getJObject(json, "length")));
8209    if (json.has("reason")) {
8210      JsonArray array = json.getAsJsonArray("reason");
8211      for (int i = 0; i < array.size(); i++) {
8212        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8213      }
8214    };
8215    if (json.has("diagnosis")) {
8216      JsonArray array = json.getAsJsonArray("diagnosis");
8217      for (int i = 0; i < array.size(); i++) {
8218        res.getDiagnosis().add(parseEncounterDiagnosisComponent(array.get(i).getAsJsonObject(), res));
8219      }
8220    };
8221    if (json.has("account")) {
8222      JsonArray array = json.getAsJsonArray("account");
8223      for (int i = 0; i < array.size(); i++) {
8224        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
8225      }
8226    };
8227    if (json.has("hospitalization"))
8228      res.setHospitalization(parseEncounterEncounterHospitalizationComponent(getJObject(json, "hospitalization"), res));
8229    if (json.has("location")) {
8230      JsonArray array = json.getAsJsonArray("location");
8231      for (int i = 0; i < array.size(); i++) {
8232        res.getLocation().add(parseEncounterEncounterLocationComponent(array.get(i).getAsJsonObject(), res));
8233      }
8234    };
8235    if (json.has("serviceProvider"))
8236      res.setServiceProvider(parseReference(getJObject(json, "serviceProvider")));
8237    if (json.has("partOf"))
8238      res.setPartOf(parseReference(getJObject(json, "partOf")));
8239  }
8240
8241  protected Encounter.StatusHistoryComponent parseEncounterStatusHistoryComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
8242    Encounter.StatusHistoryComponent res = new Encounter.StatusHistoryComponent();
8243    parseEncounterStatusHistoryComponentProperties(json, owner, res);
8244    return res;
8245  }
8246
8247  protected void parseEncounterStatusHistoryComponentProperties(JsonObject json, Encounter owner, Encounter.StatusHistoryComponent res) throws IOException, FHIRFormatError {
8248    parseBackboneProperties(json, res);
8249    if (json.has("status"))
8250      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterStatus.NULL, new Encounter.EncounterStatusEnumFactory()));
8251    if (json.has("_status"))
8252      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8253    if (json.has("period"))
8254      res.setPeriod(parsePeriod(getJObject(json, "period")));
8255  }
8256
8257  protected Encounter.ClassHistoryComponent parseEncounterClassHistoryComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
8258    Encounter.ClassHistoryComponent res = new Encounter.ClassHistoryComponent();
8259    parseEncounterClassHistoryComponentProperties(json, owner, res);
8260    return res;
8261  }
8262
8263  protected void parseEncounterClassHistoryComponentProperties(JsonObject json, Encounter owner, Encounter.ClassHistoryComponent res) throws IOException, FHIRFormatError {
8264    parseBackboneProperties(json, res);
8265    if (json.has("class"))
8266      res.setClass_(parseCoding(getJObject(json, "class")));
8267    if (json.has("period"))
8268      res.setPeriod(parsePeriod(getJObject(json, "period")));
8269  }
8270
8271  protected Encounter.EncounterParticipantComponent parseEncounterEncounterParticipantComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
8272    Encounter.EncounterParticipantComponent res = new Encounter.EncounterParticipantComponent();
8273    parseEncounterEncounterParticipantComponentProperties(json, owner, res);
8274    return res;
8275  }
8276
8277  protected void parseEncounterEncounterParticipantComponentProperties(JsonObject json, Encounter owner, Encounter.EncounterParticipantComponent res) throws IOException, FHIRFormatError {
8278    parseBackboneProperties(json, res);
8279    if (json.has("type")) {
8280      JsonArray array = json.getAsJsonArray("type");
8281      for (int i = 0; i < array.size(); i++) {
8282        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8283      }
8284    };
8285    if (json.has("period"))
8286      res.setPeriod(parsePeriod(getJObject(json, "period")));
8287    if (json.has("individual"))
8288      res.setIndividual(parseReference(getJObject(json, "individual")));
8289  }
8290
8291  protected Encounter.DiagnosisComponent parseEncounterDiagnosisComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
8292    Encounter.DiagnosisComponent res = new Encounter.DiagnosisComponent();
8293    parseEncounterDiagnosisComponentProperties(json, owner, res);
8294    return res;
8295  }
8296
8297  protected void parseEncounterDiagnosisComponentProperties(JsonObject json, Encounter owner, Encounter.DiagnosisComponent res) throws IOException, FHIRFormatError {
8298    parseBackboneProperties(json, res);
8299    if (json.has("condition"))
8300      res.setCondition(parseReference(getJObject(json, "condition")));
8301    if (json.has("role"))
8302      res.setRole(parseCodeableConcept(getJObject(json, "role")));
8303    if (json.has("rank"))
8304      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
8305    if (json.has("_rank"))
8306      parseElementProperties(getJObject(json, "_rank"), res.getRankElement());
8307  }
8308
8309  protected Encounter.EncounterHospitalizationComponent parseEncounterEncounterHospitalizationComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
8310    Encounter.EncounterHospitalizationComponent res = new Encounter.EncounterHospitalizationComponent();
8311    parseEncounterEncounterHospitalizationComponentProperties(json, owner, res);
8312    return res;
8313  }
8314
8315  protected void parseEncounterEncounterHospitalizationComponentProperties(JsonObject json, Encounter owner, Encounter.EncounterHospitalizationComponent res) throws IOException, FHIRFormatError {
8316    parseBackboneProperties(json, res);
8317    if (json.has("preAdmissionIdentifier"))
8318      res.setPreAdmissionIdentifier(parseIdentifier(getJObject(json, "preAdmissionIdentifier")));
8319    if (json.has("origin"))
8320      res.setOrigin(parseReference(getJObject(json, "origin")));
8321    if (json.has("admitSource"))
8322      res.setAdmitSource(parseCodeableConcept(getJObject(json, "admitSource")));
8323    if (json.has("reAdmission"))
8324      res.setReAdmission(parseCodeableConcept(getJObject(json, "reAdmission")));
8325    if (json.has("dietPreference")) {
8326      JsonArray array = json.getAsJsonArray("dietPreference");
8327      for (int i = 0; i < array.size(); i++) {
8328        res.getDietPreference().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8329      }
8330    };
8331    if (json.has("specialCourtesy")) {
8332      JsonArray array = json.getAsJsonArray("specialCourtesy");
8333      for (int i = 0; i < array.size(); i++) {
8334        res.getSpecialCourtesy().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8335      }
8336    };
8337    if (json.has("specialArrangement")) {
8338      JsonArray array = json.getAsJsonArray("specialArrangement");
8339      for (int i = 0; i < array.size(); i++) {
8340        res.getSpecialArrangement().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8341      }
8342    };
8343    if (json.has("destination"))
8344      res.setDestination(parseReference(getJObject(json, "destination")));
8345    if (json.has("dischargeDisposition"))
8346      res.setDischargeDisposition(parseCodeableConcept(getJObject(json, "dischargeDisposition")));
8347  }
8348
8349  protected Encounter.EncounterLocationComponent parseEncounterEncounterLocationComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
8350    Encounter.EncounterLocationComponent res = new Encounter.EncounterLocationComponent();
8351    parseEncounterEncounterLocationComponentProperties(json, owner, res);
8352    return res;
8353  }
8354
8355  protected void parseEncounterEncounterLocationComponentProperties(JsonObject json, Encounter owner, Encounter.EncounterLocationComponent res) throws IOException, FHIRFormatError {
8356    parseBackboneProperties(json, res);
8357    if (json.has("location"))
8358      res.setLocation(parseReference(getJObject(json, "location")));
8359    if (json.has("status"))
8360      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterLocationStatus.NULL, new Encounter.EncounterLocationStatusEnumFactory()));
8361    if (json.has("_status"))
8362      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8363    if (json.has("period"))
8364      res.setPeriod(parsePeriod(getJObject(json, "period")));
8365  }
8366
8367  protected Endpoint parseEndpoint(JsonObject json) throws IOException, FHIRFormatError {
8368    Endpoint res = new Endpoint();
8369    parseEndpointProperties(json, res);
8370    return res;
8371  }
8372
8373  protected void parseEndpointProperties(JsonObject json, Endpoint res) throws IOException, FHIRFormatError {
8374    parseDomainResourceProperties(json, res);
8375    if (json.has("identifier")) {
8376      JsonArray array = json.getAsJsonArray("identifier");
8377      for (int i = 0; i < array.size(); i++) {
8378        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8379      }
8380    };
8381    if (json.has("status"))
8382      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Endpoint.EndpointStatus.NULL, new Endpoint.EndpointStatusEnumFactory()));
8383    if (json.has("_status"))
8384      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8385    if (json.has("connectionType"))
8386      res.setConnectionType(parseCoding(getJObject(json, "connectionType")));
8387    if (json.has("name"))
8388      res.setNameElement(parseString(json.get("name").getAsString()));
8389    if (json.has("_name"))
8390      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
8391    if (json.has("managingOrganization"))
8392      res.setManagingOrganization(parseReference(getJObject(json, "managingOrganization")));
8393    if (json.has("contact")) {
8394      JsonArray array = json.getAsJsonArray("contact");
8395      for (int i = 0; i < array.size(); i++) {
8396        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
8397      }
8398    };
8399    if (json.has("period"))
8400      res.setPeriod(parsePeriod(getJObject(json, "period")));
8401    if (json.has("payloadType")) {
8402      JsonArray array = json.getAsJsonArray("payloadType");
8403      for (int i = 0; i < array.size(); i++) {
8404        res.getPayloadType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8405      }
8406    };
8407    if (json.has("payloadMimeType")) {
8408      JsonArray array = json.getAsJsonArray("payloadMimeType");
8409      for (int i = 0; i < array.size(); i++) {
8410        if (array.get(i).isJsonNull()) {
8411          res.getPayloadMimeType().add(new CodeType());
8412        } else {
8413          res.getPayloadMimeType().add(parseCode(array.get(i).getAsString()));
8414        }
8415      }
8416    };
8417    if (json.has("_payloadMimeType")) {
8418      JsonArray array = json.getAsJsonArray("_payloadMimeType");
8419      for (int i = 0; i < array.size(); i++) {
8420        if (i == res.getPayloadMimeType().size())
8421          res.getPayloadMimeType().add(parseCode(null));
8422        if (array.get(i) instanceof JsonObject) 
8423          parseElementProperties(array.get(i).getAsJsonObject(), res.getPayloadMimeType().get(i));
8424      }
8425    };
8426    if (json.has("address"))
8427      res.setAddressElement(parseUri(json.get("address").getAsString()));
8428    if (json.has("_address"))
8429      parseElementProperties(getJObject(json, "_address"), res.getAddressElement());
8430    if (json.has("header")) {
8431      JsonArray array = json.getAsJsonArray("header");
8432      for (int i = 0; i < array.size(); i++) {
8433        if (array.get(i).isJsonNull()) {
8434          res.getHeader().add(new StringType());
8435        } else {
8436          res.getHeader().add(parseString(array.get(i).getAsString()));
8437        }
8438      }
8439    };
8440    if (json.has("_header")) {
8441      JsonArray array = json.getAsJsonArray("_header");
8442      for (int i = 0; i < array.size(); i++) {
8443        if (i == res.getHeader().size())
8444          res.getHeader().add(parseString(null));
8445        if (array.get(i) instanceof JsonObject) 
8446          parseElementProperties(array.get(i).getAsJsonObject(), res.getHeader().get(i));
8447      }
8448    };
8449  }
8450
8451  protected EnrollmentRequest parseEnrollmentRequest(JsonObject json) throws IOException, FHIRFormatError {
8452    EnrollmentRequest res = new EnrollmentRequest();
8453    parseEnrollmentRequestProperties(json, res);
8454    return res;
8455  }
8456
8457  protected void parseEnrollmentRequestProperties(JsonObject json, EnrollmentRequest res) throws IOException, FHIRFormatError {
8458    parseDomainResourceProperties(json, res);
8459    if (json.has("identifier")) {
8460      JsonArray array = json.getAsJsonArray("identifier");
8461      for (int i = 0; i < array.size(); i++) {
8462        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8463      }
8464    };
8465    if (json.has("status"))
8466      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EnrollmentRequest.EnrollmentRequestStatus.NULL, new EnrollmentRequest.EnrollmentRequestStatusEnumFactory()));
8467    if (json.has("_status"))
8468      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8469    if (json.has("created"))
8470      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
8471    if (json.has("_created"))
8472      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
8473    if (json.has("insurer"))
8474      res.setInsurer(parseReference(getJObject(json, "insurer")));
8475    if (json.has("provider"))
8476      res.setProvider(parseReference(getJObject(json, "provider")));
8477    if (json.has("organization"))
8478      res.setOrganization(parseReference(getJObject(json, "organization")));
8479    if (json.has("subject"))
8480      res.setSubject(parseReference(getJObject(json, "subject")));
8481    if (json.has("coverage"))
8482      res.setCoverage(parseReference(getJObject(json, "coverage")));
8483  }
8484
8485  protected EnrollmentResponse parseEnrollmentResponse(JsonObject json) throws IOException, FHIRFormatError {
8486    EnrollmentResponse res = new EnrollmentResponse();
8487    parseEnrollmentResponseProperties(json, res);
8488    return res;
8489  }
8490
8491  protected void parseEnrollmentResponseProperties(JsonObject json, EnrollmentResponse res) throws IOException, FHIRFormatError {
8492    parseDomainResourceProperties(json, res);
8493    if (json.has("identifier")) {
8494      JsonArray array = json.getAsJsonArray("identifier");
8495      for (int i = 0; i < array.size(); i++) {
8496        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8497      }
8498    };
8499    if (json.has("status"))
8500      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EnrollmentResponse.EnrollmentResponseStatus.NULL, new EnrollmentResponse.EnrollmentResponseStatusEnumFactory()));
8501    if (json.has("_status"))
8502      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8503    if (json.has("request"))
8504      res.setRequest(parseReference(getJObject(json, "request")));
8505    if (json.has("outcome"))
8506      res.setOutcome(parseCodeableConcept(getJObject(json, "outcome")));
8507    if (json.has("disposition"))
8508      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
8509    if (json.has("_disposition"))
8510      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
8511    if (json.has("created"))
8512      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
8513    if (json.has("_created"))
8514      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
8515    if (json.has("organization"))
8516      res.setOrganization(parseReference(getJObject(json, "organization")));
8517    if (json.has("requestProvider"))
8518      res.setRequestProvider(parseReference(getJObject(json, "requestProvider")));
8519    if (json.has("requestOrganization"))
8520      res.setRequestOrganization(parseReference(getJObject(json, "requestOrganization")));
8521  }
8522
8523  protected EpisodeOfCare parseEpisodeOfCare(JsonObject json) throws IOException, FHIRFormatError {
8524    EpisodeOfCare res = new EpisodeOfCare();
8525    parseEpisodeOfCareProperties(json, res);
8526    return res;
8527  }
8528
8529  protected void parseEpisodeOfCareProperties(JsonObject json, EpisodeOfCare res) throws IOException, FHIRFormatError {
8530    parseDomainResourceProperties(json, res);
8531    if (json.has("identifier")) {
8532      JsonArray array = json.getAsJsonArray("identifier");
8533      for (int i = 0; i < array.size(); i++) {
8534        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8535      }
8536    };
8537    if (json.has("status"))
8538      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EpisodeOfCare.EpisodeOfCareStatus.NULL, new EpisodeOfCare.EpisodeOfCareStatusEnumFactory()));
8539    if (json.has("_status"))
8540      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8541    if (json.has("statusHistory")) {
8542      JsonArray array = json.getAsJsonArray("statusHistory");
8543      for (int i = 0; i < array.size(); i++) {
8544        res.getStatusHistory().add(parseEpisodeOfCareEpisodeOfCareStatusHistoryComponent(array.get(i).getAsJsonObject(), res));
8545      }
8546    };
8547    if (json.has("type")) {
8548      JsonArray array = json.getAsJsonArray("type");
8549      for (int i = 0; i < array.size(); i++) {
8550        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8551      }
8552    };
8553    if (json.has("diagnosis")) {
8554      JsonArray array = json.getAsJsonArray("diagnosis");
8555      for (int i = 0; i < array.size(); i++) {
8556        res.getDiagnosis().add(parseEpisodeOfCareDiagnosisComponent(array.get(i).getAsJsonObject(), res));
8557      }
8558    };
8559    if (json.has("patient"))
8560      res.setPatient(parseReference(getJObject(json, "patient")));
8561    if (json.has("managingOrganization"))
8562      res.setManagingOrganization(parseReference(getJObject(json, "managingOrganization")));
8563    if (json.has("period"))
8564      res.setPeriod(parsePeriod(getJObject(json, "period")));
8565    if (json.has("referralRequest")) {
8566      JsonArray array = json.getAsJsonArray("referralRequest");
8567      for (int i = 0; i < array.size(); i++) {
8568        res.getReferralRequest().add(parseReference(array.get(i).getAsJsonObject()));
8569      }
8570    };
8571    if (json.has("careManager"))
8572      res.setCareManager(parseReference(getJObject(json, "careManager")));
8573    if (json.has("team")) {
8574      JsonArray array = json.getAsJsonArray("team");
8575      for (int i = 0; i < array.size(); i++) {
8576        res.getTeam().add(parseReference(array.get(i).getAsJsonObject()));
8577      }
8578    };
8579    if (json.has("account")) {
8580      JsonArray array = json.getAsJsonArray("account");
8581      for (int i = 0; i < array.size(); i++) {
8582        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
8583      }
8584    };
8585  }
8586
8587  protected EpisodeOfCare.EpisodeOfCareStatusHistoryComponent parseEpisodeOfCareEpisodeOfCareStatusHistoryComponent(JsonObject json, EpisodeOfCare owner) throws IOException, FHIRFormatError {
8588    EpisodeOfCare.EpisodeOfCareStatusHistoryComponent res = new EpisodeOfCare.EpisodeOfCareStatusHistoryComponent();
8589    parseEpisodeOfCareEpisodeOfCareStatusHistoryComponentProperties(json, owner, res);
8590    return res;
8591  }
8592
8593  protected void parseEpisodeOfCareEpisodeOfCareStatusHistoryComponentProperties(JsonObject json, EpisodeOfCare owner, EpisodeOfCare.EpisodeOfCareStatusHistoryComponent res) throws IOException, FHIRFormatError {
8594    parseBackboneProperties(json, res);
8595    if (json.has("status"))
8596      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EpisodeOfCare.EpisodeOfCareStatus.NULL, new EpisodeOfCare.EpisodeOfCareStatusEnumFactory()));
8597    if (json.has("_status"))
8598      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8599    if (json.has("period"))
8600      res.setPeriod(parsePeriod(getJObject(json, "period")));
8601  }
8602
8603  protected EpisodeOfCare.DiagnosisComponent parseEpisodeOfCareDiagnosisComponent(JsonObject json, EpisodeOfCare owner) throws IOException, FHIRFormatError {
8604    EpisodeOfCare.DiagnosisComponent res = new EpisodeOfCare.DiagnosisComponent();
8605    parseEpisodeOfCareDiagnosisComponentProperties(json, owner, res);
8606    return res;
8607  }
8608
8609  protected void parseEpisodeOfCareDiagnosisComponentProperties(JsonObject json, EpisodeOfCare owner, EpisodeOfCare.DiagnosisComponent res) throws IOException, FHIRFormatError {
8610    parseBackboneProperties(json, res);
8611    if (json.has("condition"))
8612      res.setCondition(parseReference(getJObject(json, "condition")));
8613    if (json.has("role"))
8614      res.setRole(parseCodeableConcept(getJObject(json, "role")));
8615    if (json.has("rank"))
8616      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
8617    if (json.has("_rank"))
8618      parseElementProperties(getJObject(json, "_rank"), res.getRankElement());
8619  }
8620
8621  protected ExpansionProfile parseExpansionProfile(JsonObject json) throws IOException, FHIRFormatError {
8622    ExpansionProfile res = new ExpansionProfile();
8623    parseExpansionProfileProperties(json, res);
8624    return res;
8625  }
8626
8627  protected void parseExpansionProfileProperties(JsonObject json, ExpansionProfile res) throws IOException, FHIRFormatError {
8628    parseDomainResourceProperties(json, res);
8629    if (json.has("url"))
8630      res.setUrlElement(parseUri(json.get("url").getAsString()));
8631    if (json.has("_url"))
8632      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
8633    if (json.has("identifier"))
8634      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
8635    if (json.has("version"))
8636      res.setVersionElement(parseString(json.get("version").getAsString()));
8637    if (json.has("_version"))
8638      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
8639    if (json.has("name"))
8640      res.setNameElement(parseString(json.get("name").getAsString()));
8641    if (json.has("_name"))
8642      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
8643    if (json.has("status"))
8644      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
8645    if (json.has("_status"))
8646      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8647    if (json.has("experimental"))
8648      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
8649    if (json.has("_experimental"))
8650      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
8651    if (json.has("date"))
8652      res.setDateElement(parseDateTime(json.get("date").getAsString()));
8653    if (json.has("_date"))
8654      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
8655    if (json.has("publisher"))
8656      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
8657    if (json.has("_publisher"))
8658      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
8659    if (json.has("contact")) {
8660      JsonArray array = json.getAsJsonArray("contact");
8661      for (int i = 0; i < array.size(); i++) {
8662        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
8663      }
8664    };
8665    if (json.has("description"))
8666      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
8667    if (json.has("_description"))
8668      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
8669    if (json.has("useContext")) {
8670      JsonArray array = json.getAsJsonArray("useContext");
8671      for (int i = 0; i < array.size(); i++) {
8672        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
8673      }
8674    };
8675    if (json.has("jurisdiction")) {
8676      JsonArray array = json.getAsJsonArray("jurisdiction");
8677      for (int i = 0; i < array.size(); i++) {
8678        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8679      }
8680    };
8681    if (json.has("fixedVersion")) {
8682      JsonArray array = json.getAsJsonArray("fixedVersion");
8683      for (int i = 0; i < array.size(); i++) {
8684        res.getFixedVersion().add(parseExpansionProfileExpansionProfileFixedVersionComponent(array.get(i).getAsJsonObject(), res));
8685      }
8686    };
8687    if (json.has("excludedSystem"))
8688      res.setExcludedSystem(parseExpansionProfileExpansionProfileExcludedSystemComponent(getJObject(json, "excludedSystem"), res));
8689    if (json.has("includeDesignations"))
8690      res.setIncludeDesignationsElement(parseBoolean(json.get("includeDesignations").getAsBoolean()));
8691    if (json.has("_includeDesignations"))
8692      parseElementProperties(getJObject(json, "_includeDesignations"), res.getIncludeDesignationsElement());
8693    if (json.has("designation"))
8694      res.setDesignation(parseExpansionProfileExpansionProfileDesignationComponent(getJObject(json, "designation"), res));
8695    if (json.has("includeDefinition"))
8696      res.setIncludeDefinitionElement(parseBoolean(json.get("includeDefinition").getAsBoolean()));
8697    if (json.has("_includeDefinition"))
8698      parseElementProperties(getJObject(json, "_includeDefinition"), res.getIncludeDefinitionElement());
8699    if (json.has("activeOnly"))
8700      res.setActiveOnlyElement(parseBoolean(json.get("activeOnly").getAsBoolean()));
8701    if (json.has("_activeOnly"))
8702      parseElementProperties(getJObject(json, "_activeOnly"), res.getActiveOnlyElement());
8703    if (json.has("excludeNested"))
8704      res.setExcludeNestedElement(parseBoolean(json.get("excludeNested").getAsBoolean()));
8705    if (json.has("_excludeNested"))
8706      parseElementProperties(getJObject(json, "_excludeNested"), res.getExcludeNestedElement());
8707    if (json.has("excludeNotForUI"))
8708      res.setExcludeNotForUIElement(parseBoolean(json.get("excludeNotForUI").getAsBoolean()));
8709    if (json.has("_excludeNotForUI"))
8710      parseElementProperties(getJObject(json, "_excludeNotForUI"), res.getExcludeNotForUIElement());
8711    if (json.has("excludePostCoordinated"))
8712      res.setExcludePostCoordinatedElement(parseBoolean(json.get("excludePostCoordinated").getAsBoolean()));
8713    if (json.has("_excludePostCoordinated"))
8714      parseElementProperties(getJObject(json, "_excludePostCoordinated"), res.getExcludePostCoordinatedElement());
8715    if (json.has("displayLanguage"))
8716      res.setDisplayLanguageElement(parseCode(json.get("displayLanguage").getAsString()));
8717    if (json.has("_displayLanguage"))
8718      parseElementProperties(getJObject(json, "_displayLanguage"), res.getDisplayLanguageElement());
8719    if (json.has("limitedExpansion"))
8720      res.setLimitedExpansionElement(parseBoolean(json.get("limitedExpansion").getAsBoolean()));
8721    if (json.has("_limitedExpansion"))
8722      parseElementProperties(getJObject(json, "_limitedExpansion"), res.getLimitedExpansionElement());
8723  }
8724
8725  protected ExpansionProfile.ExpansionProfileFixedVersionComponent parseExpansionProfileExpansionProfileFixedVersionComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
8726    ExpansionProfile.ExpansionProfileFixedVersionComponent res = new ExpansionProfile.ExpansionProfileFixedVersionComponent();
8727    parseExpansionProfileExpansionProfileFixedVersionComponentProperties(json, owner, res);
8728    return res;
8729  }
8730
8731  protected void parseExpansionProfileExpansionProfileFixedVersionComponentProperties(JsonObject json, ExpansionProfile owner, ExpansionProfile.ExpansionProfileFixedVersionComponent res) throws IOException, FHIRFormatError {
8732    parseBackboneProperties(json, res);
8733    if (json.has("system"))
8734      res.setSystemElement(parseUri(json.get("system").getAsString()));
8735    if (json.has("_system"))
8736      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
8737    if (json.has("version"))
8738      res.setVersionElement(parseString(json.get("version").getAsString()));
8739    if (json.has("_version"))
8740      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
8741    if (json.has("mode"))
8742      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), ExpansionProfile.SystemVersionProcessingMode.NULL, new ExpansionProfile.SystemVersionProcessingModeEnumFactory()));
8743    if (json.has("_mode"))
8744      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
8745  }
8746
8747  protected ExpansionProfile.ExpansionProfileExcludedSystemComponent parseExpansionProfileExpansionProfileExcludedSystemComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
8748    ExpansionProfile.ExpansionProfileExcludedSystemComponent res = new ExpansionProfile.ExpansionProfileExcludedSystemComponent();
8749    parseExpansionProfileExpansionProfileExcludedSystemComponentProperties(json, owner, res);
8750    return res;
8751  }
8752
8753  protected void parseExpansionProfileExpansionProfileExcludedSystemComponentProperties(JsonObject json, ExpansionProfile owner, ExpansionProfile.ExpansionProfileExcludedSystemComponent res) throws IOException, FHIRFormatError {
8754    parseBackboneProperties(json, res);
8755    if (json.has("system"))
8756      res.setSystemElement(parseUri(json.get("system").getAsString()));
8757    if (json.has("_system"))
8758      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
8759    if (json.has("version"))
8760      res.setVersionElement(parseString(json.get("version").getAsString()));
8761    if (json.has("_version"))
8762      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
8763  }
8764
8765  protected ExpansionProfile.ExpansionProfileDesignationComponent parseExpansionProfileExpansionProfileDesignationComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
8766    ExpansionProfile.ExpansionProfileDesignationComponent res = new ExpansionProfile.ExpansionProfileDesignationComponent();
8767    parseExpansionProfileExpansionProfileDesignationComponentProperties(json, owner, res);
8768    return res;
8769  }
8770
8771  protected void parseExpansionProfileExpansionProfileDesignationComponentProperties(JsonObject json, ExpansionProfile owner, ExpansionProfile.ExpansionProfileDesignationComponent res) throws IOException, FHIRFormatError {
8772    parseBackboneProperties(json, res);
8773    if (json.has("include"))
8774      res.setInclude(parseExpansionProfileDesignationIncludeComponent(getJObject(json, "include"), owner));
8775    if (json.has("exclude"))
8776      res.setExclude(parseExpansionProfileDesignationExcludeComponent(getJObject(json, "exclude"), owner));
8777  }
8778
8779  protected ExpansionProfile.DesignationIncludeComponent parseExpansionProfileDesignationIncludeComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
8780    ExpansionProfile.DesignationIncludeComponent res = new ExpansionProfile.DesignationIncludeComponent();
8781    parseExpansionProfileDesignationIncludeComponentProperties(json, owner, res);
8782    return res;
8783  }
8784
8785  protected void parseExpansionProfileDesignationIncludeComponentProperties(JsonObject json, ExpansionProfile owner, ExpansionProfile.DesignationIncludeComponent res) throws IOException, FHIRFormatError {
8786    parseBackboneProperties(json, res);
8787    if (json.has("designation")) {
8788      JsonArray array = json.getAsJsonArray("designation");
8789      for (int i = 0; i < array.size(); i++) {
8790        res.getDesignation().add(parseExpansionProfileDesignationIncludeDesignationComponent(array.get(i).getAsJsonObject(), owner));
8791      }
8792    };
8793  }
8794
8795  protected ExpansionProfile.DesignationIncludeDesignationComponent parseExpansionProfileDesignationIncludeDesignationComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
8796    ExpansionProfile.DesignationIncludeDesignationComponent res = new ExpansionProfile.DesignationIncludeDesignationComponent();
8797    parseExpansionProfileDesignationIncludeDesignationComponentProperties(json, owner, res);
8798    return res;
8799  }
8800
8801  protected void parseExpansionProfileDesignationIncludeDesignationComponentProperties(JsonObject json, ExpansionProfile owner, ExpansionProfile.DesignationIncludeDesignationComponent res) throws IOException, FHIRFormatError {
8802    parseBackboneProperties(json, res);
8803    if (json.has("language"))
8804      res.setLanguageElement(parseCode(json.get("language").getAsString()));
8805    if (json.has("_language"))
8806      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
8807    if (json.has("use"))
8808      res.setUse(parseCoding(getJObject(json, "use")));
8809  }
8810
8811  protected ExpansionProfile.DesignationExcludeComponent parseExpansionProfileDesignationExcludeComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
8812    ExpansionProfile.DesignationExcludeComponent res = new ExpansionProfile.DesignationExcludeComponent();
8813    parseExpansionProfileDesignationExcludeComponentProperties(json, owner, res);
8814    return res;
8815  }
8816
8817  protected void parseExpansionProfileDesignationExcludeComponentProperties(JsonObject json, ExpansionProfile owner, ExpansionProfile.DesignationExcludeComponent res) throws IOException, FHIRFormatError {
8818    parseBackboneProperties(json, res);
8819    if (json.has("designation")) {
8820      JsonArray array = json.getAsJsonArray("designation");
8821      for (int i = 0; i < array.size(); i++) {
8822        res.getDesignation().add(parseExpansionProfileDesignationExcludeDesignationComponent(array.get(i).getAsJsonObject(), owner));
8823      }
8824    };
8825  }
8826
8827  protected ExpansionProfile.DesignationExcludeDesignationComponent parseExpansionProfileDesignationExcludeDesignationComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
8828    ExpansionProfile.DesignationExcludeDesignationComponent res = new ExpansionProfile.DesignationExcludeDesignationComponent();
8829    parseExpansionProfileDesignationExcludeDesignationComponentProperties(json, owner, res);
8830    return res;
8831  }
8832
8833  protected void parseExpansionProfileDesignationExcludeDesignationComponentProperties(JsonObject json, ExpansionProfile owner, ExpansionProfile.DesignationExcludeDesignationComponent res) throws IOException, FHIRFormatError {
8834    parseBackboneProperties(json, res);
8835    if (json.has("language"))
8836      res.setLanguageElement(parseCode(json.get("language").getAsString()));
8837    if (json.has("_language"))
8838      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
8839    if (json.has("use"))
8840      res.setUse(parseCoding(getJObject(json, "use")));
8841  }
8842
8843  protected ExplanationOfBenefit parseExplanationOfBenefit(JsonObject json) throws IOException, FHIRFormatError {
8844    ExplanationOfBenefit res = new ExplanationOfBenefit();
8845    parseExplanationOfBenefitProperties(json, res);
8846    return res;
8847  }
8848
8849  protected void parseExplanationOfBenefitProperties(JsonObject json, ExplanationOfBenefit res) throws IOException, FHIRFormatError {
8850    parseDomainResourceProperties(json, res);
8851    if (json.has("identifier")) {
8852      JsonArray array = json.getAsJsonArray("identifier");
8853      for (int i = 0; i < array.size(); i++) {
8854        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8855      }
8856    };
8857    if (json.has("status"))
8858      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ExplanationOfBenefit.ExplanationOfBenefitStatus.NULL, new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory()));
8859    if (json.has("_status"))
8860      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
8861    if (json.has("type"))
8862      res.setType(parseCodeableConcept(getJObject(json, "type")));
8863    if (json.has("subType")) {
8864      JsonArray array = json.getAsJsonArray("subType");
8865      for (int i = 0; i < array.size(); i++) {
8866        res.getSubType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8867      }
8868    };
8869    if (json.has("patient"))
8870      res.setPatient(parseReference(getJObject(json, "patient")));
8871    if (json.has("billablePeriod"))
8872      res.setBillablePeriod(parsePeriod(getJObject(json, "billablePeriod")));
8873    if (json.has("created"))
8874      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
8875    if (json.has("_created"))
8876      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
8877    if (json.has("enterer"))
8878      res.setEnterer(parseReference(getJObject(json, "enterer")));
8879    if (json.has("insurer"))
8880      res.setInsurer(parseReference(getJObject(json, "insurer")));
8881    if (json.has("provider"))
8882      res.setProvider(parseReference(getJObject(json, "provider")));
8883    if (json.has("organization"))
8884      res.setOrganization(parseReference(getJObject(json, "organization")));
8885    if (json.has("referral"))
8886      res.setReferral(parseReference(getJObject(json, "referral")));
8887    if (json.has("facility"))
8888      res.setFacility(parseReference(getJObject(json, "facility")));
8889    if (json.has("claim"))
8890      res.setClaim(parseReference(getJObject(json, "claim")));
8891    if (json.has("claimResponse"))
8892      res.setClaimResponse(parseReference(getJObject(json, "claimResponse")));
8893    if (json.has("outcome"))
8894      res.setOutcome(parseCodeableConcept(getJObject(json, "outcome")));
8895    if (json.has("disposition"))
8896      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
8897    if (json.has("_disposition"))
8898      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
8899    if (json.has("related")) {
8900      JsonArray array = json.getAsJsonArray("related");
8901      for (int i = 0; i < array.size(); i++) {
8902        res.getRelated().add(parseExplanationOfBenefitRelatedClaimComponent(array.get(i).getAsJsonObject(), res));
8903      }
8904    };
8905    if (json.has("prescription"))
8906      res.setPrescription(parseReference(getJObject(json, "prescription")));
8907    if (json.has("originalPrescription"))
8908      res.setOriginalPrescription(parseReference(getJObject(json, "originalPrescription")));
8909    if (json.has("payee"))
8910      res.setPayee(parseExplanationOfBenefitPayeeComponent(getJObject(json, "payee"), res));
8911    if (json.has("information")) {
8912      JsonArray array = json.getAsJsonArray("information");
8913      for (int i = 0; i < array.size(); i++) {
8914        res.getInformation().add(parseExplanationOfBenefitSupportingInformationComponent(array.get(i).getAsJsonObject(), res));
8915      }
8916    };
8917    if (json.has("careTeam")) {
8918      JsonArray array = json.getAsJsonArray("careTeam");
8919      for (int i = 0; i < array.size(); i++) {
8920        res.getCareTeam().add(parseExplanationOfBenefitCareTeamComponent(array.get(i).getAsJsonObject(), res));
8921      }
8922    };
8923    if (json.has("diagnosis")) {
8924      JsonArray array = json.getAsJsonArray("diagnosis");
8925      for (int i = 0; i < array.size(); i++) {
8926        res.getDiagnosis().add(parseExplanationOfBenefitDiagnosisComponent(array.get(i).getAsJsonObject(), res));
8927      }
8928    };
8929    if (json.has("procedure")) {
8930      JsonArray array = json.getAsJsonArray("procedure");
8931      for (int i = 0; i < array.size(); i++) {
8932        res.getProcedure().add(parseExplanationOfBenefitProcedureComponent(array.get(i).getAsJsonObject(), res));
8933      }
8934    };
8935    if (json.has("precedence"))
8936      res.setPrecedenceElement(parsePositiveInt(json.get("precedence").getAsString()));
8937    if (json.has("_precedence"))
8938      parseElementProperties(getJObject(json, "_precedence"), res.getPrecedenceElement());
8939    if (json.has("insurance"))
8940      res.setInsurance(parseExplanationOfBenefitInsuranceComponent(getJObject(json, "insurance"), res));
8941    if (json.has("accident"))
8942      res.setAccident(parseExplanationOfBenefitAccidentComponent(getJObject(json, "accident"), res));
8943    if (json.has("employmentImpacted"))
8944      res.setEmploymentImpacted(parsePeriod(getJObject(json, "employmentImpacted")));
8945    if (json.has("hospitalization"))
8946      res.setHospitalization(parsePeriod(getJObject(json, "hospitalization")));
8947    if (json.has("item")) {
8948      JsonArray array = json.getAsJsonArray("item");
8949      for (int i = 0; i < array.size(); i++) {
8950        res.getItem().add(parseExplanationOfBenefitItemComponent(array.get(i).getAsJsonObject(), res));
8951      }
8952    };
8953    if (json.has("addItem")) {
8954      JsonArray array = json.getAsJsonArray("addItem");
8955      for (int i = 0; i < array.size(); i++) {
8956        res.getAddItem().add(parseExplanationOfBenefitAddedItemComponent(array.get(i).getAsJsonObject(), res));
8957      }
8958    };
8959    if (json.has("totalCost"))
8960      res.setTotalCost(parseMoney(getJObject(json, "totalCost")));
8961    if (json.has("unallocDeductable"))
8962      res.setUnallocDeductable(parseMoney(getJObject(json, "unallocDeductable")));
8963    if (json.has("totalBenefit"))
8964      res.setTotalBenefit(parseMoney(getJObject(json, "totalBenefit")));
8965    if (json.has("payment"))
8966      res.setPayment(parseExplanationOfBenefitPaymentComponent(getJObject(json, "payment"), res));
8967    if (json.has("form"))
8968      res.setForm(parseCodeableConcept(getJObject(json, "form")));
8969    if (json.has("processNote")) {
8970      JsonArray array = json.getAsJsonArray("processNote");
8971      for (int i = 0; i < array.size(); i++) {
8972        res.getProcessNote().add(parseExplanationOfBenefitNoteComponent(array.get(i).getAsJsonObject(), res));
8973      }
8974    };
8975    if (json.has("benefitBalance")) {
8976      JsonArray array = json.getAsJsonArray("benefitBalance");
8977      for (int i = 0; i < array.size(); i++) {
8978        res.getBenefitBalance().add(parseExplanationOfBenefitBenefitBalanceComponent(array.get(i).getAsJsonObject(), res));
8979      }
8980    };
8981  }
8982
8983  protected ExplanationOfBenefit.RelatedClaimComponent parseExplanationOfBenefitRelatedClaimComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
8984    ExplanationOfBenefit.RelatedClaimComponent res = new ExplanationOfBenefit.RelatedClaimComponent();
8985    parseExplanationOfBenefitRelatedClaimComponentProperties(json, owner, res);
8986    return res;
8987  }
8988
8989  protected void parseExplanationOfBenefitRelatedClaimComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.RelatedClaimComponent res) throws IOException, FHIRFormatError {
8990    parseBackboneProperties(json, res);
8991    if (json.has("claim"))
8992      res.setClaim(parseReference(getJObject(json, "claim")));
8993    if (json.has("relationship"))
8994      res.setRelationship(parseCodeableConcept(getJObject(json, "relationship")));
8995    if (json.has("reference"))
8996      res.setReference(parseIdentifier(getJObject(json, "reference")));
8997  }
8998
8999  protected ExplanationOfBenefit.PayeeComponent parseExplanationOfBenefitPayeeComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9000    ExplanationOfBenefit.PayeeComponent res = new ExplanationOfBenefit.PayeeComponent();
9001    parseExplanationOfBenefitPayeeComponentProperties(json, owner, res);
9002    return res;
9003  }
9004
9005  protected void parseExplanationOfBenefitPayeeComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.PayeeComponent res) throws IOException, FHIRFormatError {
9006    parseBackboneProperties(json, res);
9007    if (json.has("type"))
9008      res.setType(parseCodeableConcept(getJObject(json, "type")));
9009    if (json.has("resourceType"))
9010      res.setResourceType(parseCodeableConcept(getJObject(json, "resourceType")));
9011    if (json.has("party"))
9012      res.setParty(parseReference(getJObject(json, "party")));
9013  }
9014
9015  protected ExplanationOfBenefit.SupportingInformationComponent parseExplanationOfBenefitSupportingInformationComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9016    ExplanationOfBenefit.SupportingInformationComponent res = new ExplanationOfBenefit.SupportingInformationComponent();
9017    parseExplanationOfBenefitSupportingInformationComponentProperties(json, owner, res);
9018    return res;
9019  }
9020
9021  protected void parseExplanationOfBenefitSupportingInformationComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.SupportingInformationComponent res) throws IOException, FHIRFormatError {
9022    parseBackboneProperties(json, res);
9023    if (json.has("sequence"))
9024      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
9025    if (json.has("_sequence"))
9026      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
9027    if (json.has("category"))
9028      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
9029    if (json.has("code"))
9030      res.setCode(parseCodeableConcept(getJObject(json, "code")));
9031    Type timing = parseType("timing", json);
9032    if (timing != null)
9033      res.setTiming(timing);
9034    Type value = parseType("value", json);
9035    if (value != null)
9036      res.setValue(value);
9037    if (json.has("reason"))
9038      res.setReason(parseCoding(getJObject(json, "reason")));
9039  }
9040
9041  protected ExplanationOfBenefit.CareTeamComponent parseExplanationOfBenefitCareTeamComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9042    ExplanationOfBenefit.CareTeamComponent res = new ExplanationOfBenefit.CareTeamComponent();
9043    parseExplanationOfBenefitCareTeamComponentProperties(json, owner, res);
9044    return res;
9045  }
9046
9047  protected void parseExplanationOfBenefitCareTeamComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.CareTeamComponent res) throws IOException, FHIRFormatError {
9048    parseBackboneProperties(json, res);
9049    if (json.has("sequence"))
9050      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
9051    if (json.has("_sequence"))
9052      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
9053    if (json.has("provider"))
9054      res.setProvider(parseReference(getJObject(json, "provider")));
9055    if (json.has("responsible"))
9056      res.setResponsibleElement(parseBoolean(json.get("responsible").getAsBoolean()));
9057    if (json.has("_responsible"))
9058      parseElementProperties(getJObject(json, "_responsible"), res.getResponsibleElement());
9059    if (json.has("role"))
9060      res.setRole(parseCodeableConcept(getJObject(json, "role")));
9061    if (json.has("qualification"))
9062      res.setQualification(parseCodeableConcept(getJObject(json, "qualification")));
9063  }
9064
9065  protected ExplanationOfBenefit.DiagnosisComponent parseExplanationOfBenefitDiagnosisComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9066    ExplanationOfBenefit.DiagnosisComponent res = new ExplanationOfBenefit.DiagnosisComponent();
9067    parseExplanationOfBenefitDiagnosisComponentProperties(json, owner, res);
9068    return res;
9069  }
9070
9071  protected void parseExplanationOfBenefitDiagnosisComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.DiagnosisComponent res) throws IOException, FHIRFormatError {
9072    parseBackboneProperties(json, res);
9073    if (json.has("sequence"))
9074      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
9075    if (json.has("_sequence"))
9076      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
9077    Type diagnosis = parseType("diagnosis", json);
9078    if (diagnosis != null)
9079      res.setDiagnosis(diagnosis);
9080    if (json.has("type")) {
9081      JsonArray array = json.getAsJsonArray("type");
9082      for (int i = 0; i < array.size(); i++) {
9083        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9084      }
9085    };
9086    if (json.has("packageCode"))
9087      res.setPackageCode(parseCodeableConcept(getJObject(json, "packageCode")));
9088  }
9089
9090  protected ExplanationOfBenefit.ProcedureComponent parseExplanationOfBenefitProcedureComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9091    ExplanationOfBenefit.ProcedureComponent res = new ExplanationOfBenefit.ProcedureComponent();
9092    parseExplanationOfBenefitProcedureComponentProperties(json, owner, res);
9093    return res;
9094  }
9095
9096  protected void parseExplanationOfBenefitProcedureComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.ProcedureComponent res) throws IOException, FHIRFormatError {
9097    parseBackboneProperties(json, res);
9098    if (json.has("sequence"))
9099      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
9100    if (json.has("_sequence"))
9101      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
9102    if (json.has("date"))
9103      res.setDateElement(parseDateTime(json.get("date").getAsString()));
9104    if (json.has("_date"))
9105      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
9106    Type procedure = parseType("procedure", json);
9107    if (procedure != null)
9108      res.setProcedure(procedure);
9109  }
9110
9111  protected ExplanationOfBenefit.InsuranceComponent parseExplanationOfBenefitInsuranceComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9112    ExplanationOfBenefit.InsuranceComponent res = new ExplanationOfBenefit.InsuranceComponent();
9113    parseExplanationOfBenefitInsuranceComponentProperties(json, owner, res);
9114    return res;
9115  }
9116
9117  protected void parseExplanationOfBenefitInsuranceComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.InsuranceComponent res) throws IOException, FHIRFormatError {
9118    parseBackboneProperties(json, res);
9119    if (json.has("coverage"))
9120      res.setCoverage(parseReference(getJObject(json, "coverage")));
9121    if (json.has("preAuthRef")) {
9122      JsonArray array = json.getAsJsonArray("preAuthRef");
9123      for (int i = 0; i < array.size(); i++) {
9124        if (array.get(i).isJsonNull()) {
9125          res.getPreAuthRef().add(new StringType());
9126        } else {
9127          res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
9128        }
9129      }
9130    };
9131    if (json.has("_preAuthRef")) {
9132      JsonArray array = json.getAsJsonArray("_preAuthRef");
9133      for (int i = 0; i < array.size(); i++) {
9134        if (i == res.getPreAuthRef().size())
9135          res.getPreAuthRef().add(parseString(null));
9136        if (array.get(i) instanceof JsonObject) 
9137          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
9138      }
9139    };
9140  }
9141
9142  protected ExplanationOfBenefit.AccidentComponent parseExplanationOfBenefitAccidentComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9143    ExplanationOfBenefit.AccidentComponent res = new ExplanationOfBenefit.AccidentComponent();
9144    parseExplanationOfBenefitAccidentComponentProperties(json, owner, res);
9145    return res;
9146  }
9147
9148  protected void parseExplanationOfBenefitAccidentComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AccidentComponent res) throws IOException, FHIRFormatError {
9149    parseBackboneProperties(json, res);
9150    if (json.has("date"))
9151      res.setDateElement(parseDate(json.get("date").getAsString()));
9152    if (json.has("_date"))
9153      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
9154    if (json.has("type"))
9155      res.setType(parseCodeableConcept(getJObject(json, "type")));
9156    Type location = parseType("location", json);
9157    if (location != null)
9158      res.setLocation(location);
9159  }
9160
9161  protected ExplanationOfBenefit.ItemComponent parseExplanationOfBenefitItemComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9162    ExplanationOfBenefit.ItemComponent res = new ExplanationOfBenefit.ItemComponent();
9163    parseExplanationOfBenefitItemComponentProperties(json, owner, res);
9164    return res;
9165  }
9166
9167  protected void parseExplanationOfBenefitItemComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.ItemComponent res) throws IOException, FHIRFormatError {
9168    parseBackboneProperties(json, res);
9169    if (json.has("sequence"))
9170      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
9171    if (json.has("_sequence"))
9172      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
9173    if (json.has("careTeamLinkId")) {
9174      JsonArray array = json.getAsJsonArray("careTeamLinkId");
9175      for (int i = 0; i < array.size(); i++) {
9176        if (array.get(i).isJsonNull()) {
9177          res.getCareTeamLinkId().add(new PositiveIntType());
9178        } else {
9179          res.getCareTeamLinkId().add(parsePositiveInt(array.get(i).getAsString()));
9180        }
9181      }
9182    };
9183    if (json.has("_careTeamLinkId")) {
9184      JsonArray array = json.getAsJsonArray("_careTeamLinkId");
9185      for (int i = 0; i < array.size(); i++) {
9186        if (i == res.getCareTeamLinkId().size())
9187          res.getCareTeamLinkId().add(parsePositiveInt(null));
9188        if (array.get(i) instanceof JsonObject) 
9189          parseElementProperties(array.get(i).getAsJsonObject(), res.getCareTeamLinkId().get(i));
9190      }
9191    };
9192    if (json.has("diagnosisLinkId")) {
9193      JsonArray array = json.getAsJsonArray("diagnosisLinkId");
9194      for (int i = 0; i < array.size(); i++) {
9195        if (array.get(i).isJsonNull()) {
9196          res.getDiagnosisLinkId().add(new PositiveIntType());
9197        } else {
9198          res.getDiagnosisLinkId().add(parsePositiveInt(array.get(i).getAsString()));
9199        }
9200      }
9201    };
9202    if (json.has("_diagnosisLinkId")) {
9203      JsonArray array = json.getAsJsonArray("_diagnosisLinkId");
9204      for (int i = 0; i < array.size(); i++) {
9205        if (i == res.getDiagnosisLinkId().size())
9206          res.getDiagnosisLinkId().add(parsePositiveInt(null));
9207        if (array.get(i) instanceof JsonObject) 
9208          parseElementProperties(array.get(i).getAsJsonObject(), res.getDiagnosisLinkId().get(i));
9209      }
9210    };
9211    if (json.has("procedureLinkId")) {
9212      JsonArray array = json.getAsJsonArray("procedureLinkId");
9213      for (int i = 0; i < array.size(); i++) {
9214        if (array.get(i).isJsonNull()) {
9215          res.getProcedureLinkId().add(new PositiveIntType());
9216        } else {
9217          res.getProcedureLinkId().add(parsePositiveInt(array.get(i).getAsString()));
9218        }
9219      }
9220    };
9221    if (json.has("_procedureLinkId")) {
9222      JsonArray array = json.getAsJsonArray("_procedureLinkId");
9223      for (int i = 0; i < array.size(); i++) {
9224        if (i == res.getProcedureLinkId().size())
9225          res.getProcedureLinkId().add(parsePositiveInt(null));
9226        if (array.get(i) instanceof JsonObject) 
9227          parseElementProperties(array.get(i).getAsJsonObject(), res.getProcedureLinkId().get(i));
9228      }
9229    };
9230    if (json.has("informationLinkId")) {
9231      JsonArray array = json.getAsJsonArray("informationLinkId");
9232      for (int i = 0; i < array.size(); i++) {
9233        if (array.get(i).isJsonNull()) {
9234          res.getInformationLinkId().add(new PositiveIntType());
9235        } else {
9236          res.getInformationLinkId().add(parsePositiveInt(array.get(i).getAsString()));
9237        }
9238      }
9239    };
9240    if (json.has("_informationLinkId")) {
9241      JsonArray array = json.getAsJsonArray("_informationLinkId");
9242      for (int i = 0; i < array.size(); i++) {
9243        if (i == res.getInformationLinkId().size())
9244          res.getInformationLinkId().add(parsePositiveInt(null));
9245        if (array.get(i) instanceof JsonObject) 
9246          parseElementProperties(array.get(i).getAsJsonObject(), res.getInformationLinkId().get(i));
9247      }
9248    };
9249    if (json.has("revenue"))
9250      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
9251    if (json.has("category"))
9252      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
9253    if (json.has("service"))
9254      res.setService(parseCodeableConcept(getJObject(json, "service")));
9255    if (json.has("modifier")) {
9256      JsonArray array = json.getAsJsonArray("modifier");
9257      for (int i = 0; i < array.size(); i++) {
9258        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9259      }
9260    };
9261    if (json.has("programCode")) {
9262      JsonArray array = json.getAsJsonArray("programCode");
9263      for (int i = 0; i < array.size(); i++) {
9264        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9265      }
9266    };
9267    Type serviced = parseType("serviced", json);
9268    if (serviced != null)
9269      res.setServiced(serviced);
9270    Type location = parseType("location", json);
9271    if (location != null)
9272      res.setLocation(location);
9273    if (json.has("quantity"))
9274      res.setQuantity(parseSimpleQuantity(getJObject(json, "quantity")));
9275    if (json.has("unitPrice"))
9276      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
9277    if (json.has("factor"))
9278      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
9279    if (json.has("_factor"))
9280      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
9281    if (json.has("net"))
9282      res.setNet(parseMoney(getJObject(json, "net")));
9283    if (json.has("udi")) {
9284      JsonArray array = json.getAsJsonArray("udi");
9285      for (int i = 0; i < array.size(); i++) {
9286        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
9287      }
9288    };
9289    if (json.has("bodySite"))
9290      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
9291    if (json.has("subSite")) {
9292      JsonArray array = json.getAsJsonArray("subSite");
9293      for (int i = 0; i < array.size(); i++) {
9294        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9295      }
9296    };
9297    if (json.has("encounter")) {
9298      JsonArray array = json.getAsJsonArray("encounter");
9299      for (int i = 0; i < array.size(); i++) {
9300        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
9301      }
9302    };
9303    if (json.has("noteNumber")) {
9304      JsonArray array = json.getAsJsonArray("noteNumber");
9305      for (int i = 0; i < array.size(); i++) {
9306        if (array.get(i).isJsonNull()) {
9307          res.getNoteNumber().add(new PositiveIntType());
9308        } else {
9309          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
9310        }
9311      }
9312    };
9313    if (json.has("_noteNumber")) {
9314      JsonArray array = json.getAsJsonArray("_noteNumber");
9315      for (int i = 0; i < array.size(); i++) {
9316        if (i == res.getNoteNumber().size())
9317          res.getNoteNumber().add(parsePositiveInt(null));
9318        if (array.get(i) instanceof JsonObject) 
9319          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
9320      }
9321    };
9322    if (json.has("adjudication")) {
9323      JsonArray array = json.getAsJsonArray("adjudication");
9324      for (int i = 0; i < array.size(); i++) {
9325        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
9326      }
9327    };
9328    if (json.has("detail")) {
9329      JsonArray array = json.getAsJsonArray("detail");
9330      for (int i = 0; i < array.size(); i++) {
9331        res.getDetail().add(parseExplanationOfBenefitDetailComponent(array.get(i).getAsJsonObject(), owner));
9332      }
9333    };
9334  }
9335
9336  protected ExplanationOfBenefit.AdjudicationComponent parseExplanationOfBenefitAdjudicationComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9337    ExplanationOfBenefit.AdjudicationComponent res = new ExplanationOfBenefit.AdjudicationComponent();
9338    parseExplanationOfBenefitAdjudicationComponentProperties(json, owner, res);
9339    return res;
9340  }
9341
9342  protected void parseExplanationOfBenefitAdjudicationComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AdjudicationComponent res) throws IOException, FHIRFormatError {
9343    parseBackboneProperties(json, res);
9344    if (json.has("category"))
9345      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
9346    if (json.has("reason"))
9347      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
9348    if (json.has("amount"))
9349      res.setAmount(parseMoney(getJObject(json, "amount")));
9350    if (json.has("value"))
9351      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
9352    if (json.has("_value"))
9353      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
9354  }
9355
9356  protected ExplanationOfBenefit.DetailComponent parseExplanationOfBenefitDetailComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9357    ExplanationOfBenefit.DetailComponent res = new ExplanationOfBenefit.DetailComponent();
9358    parseExplanationOfBenefitDetailComponentProperties(json, owner, res);
9359    return res;
9360  }
9361
9362  protected void parseExplanationOfBenefitDetailComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.DetailComponent res) throws IOException, FHIRFormatError {
9363    parseBackboneProperties(json, res);
9364    if (json.has("sequence"))
9365      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
9366    if (json.has("_sequence"))
9367      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
9368    if (json.has("type"))
9369      res.setType(parseCodeableConcept(getJObject(json, "type")));
9370    if (json.has("revenue"))
9371      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
9372    if (json.has("category"))
9373      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
9374    if (json.has("service"))
9375      res.setService(parseCodeableConcept(getJObject(json, "service")));
9376    if (json.has("modifier")) {
9377      JsonArray array = json.getAsJsonArray("modifier");
9378      for (int i = 0; i < array.size(); i++) {
9379        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9380      }
9381    };
9382    if (json.has("programCode")) {
9383      JsonArray array = json.getAsJsonArray("programCode");
9384      for (int i = 0; i < array.size(); i++) {
9385        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9386      }
9387    };
9388    if (json.has("quantity"))
9389      res.setQuantity(parseSimpleQuantity(getJObject(json, "quantity")));
9390    if (json.has("unitPrice"))
9391      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
9392    if (json.has("factor"))
9393      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
9394    if (json.has("_factor"))
9395      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
9396    if (json.has("net"))
9397      res.setNet(parseMoney(getJObject(json, "net")));
9398    if (json.has("udi")) {
9399      JsonArray array = json.getAsJsonArray("udi");
9400      for (int i = 0; i < array.size(); i++) {
9401        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
9402      }
9403    };
9404    if (json.has("noteNumber")) {
9405      JsonArray array = json.getAsJsonArray("noteNumber");
9406      for (int i = 0; i < array.size(); i++) {
9407        if (array.get(i).isJsonNull()) {
9408          res.getNoteNumber().add(new PositiveIntType());
9409        } else {
9410          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
9411        }
9412      }
9413    };
9414    if (json.has("_noteNumber")) {
9415      JsonArray array = json.getAsJsonArray("_noteNumber");
9416      for (int i = 0; i < array.size(); i++) {
9417        if (i == res.getNoteNumber().size())
9418          res.getNoteNumber().add(parsePositiveInt(null));
9419        if (array.get(i) instanceof JsonObject) 
9420          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
9421      }
9422    };
9423    if (json.has("adjudication")) {
9424      JsonArray array = json.getAsJsonArray("adjudication");
9425      for (int i = 0; i < array.size(); i++) {
9426        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
9427      }
9428    };
9429    if (json.has("subDetail")) {
9430      JsonArray array = json.getAsJsonArray("subDetail");
9431      for (int i = 0; i < array.size(); i++) {
9432        res.getSubDetail().add(parseExplanationOfBenefitSubDetailComponent(array.get(i).getAsJsonObject(), owner));
9433      }
9434    };
9435  }
9436
9437  protected ExplanationOfBenefit.SubDetailComponent parseExplanationOfBenefitSubDetailComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9438    ExplanationOfBenefit.SubDetailComponent res = new ExplanationOfBenefit.SubDetailComponent();
9439    parseExplanationOfBenefitSubDetailComponentProperties(json, owner, res);
9440    return res;
9441  }
9442
9443  protected void parseExplanationOfBenefitSubDetailComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.SubDetailComponent res) throws IOException, FHIRFormatError {
9444    parseBackboneProperties(json, res);
9445    if (json.has("sequence"))
9446      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
9447    if (json.has("_sequence"))
9448      parseElementProperties(getJObject(json, "_sequence"), res.getSequenceElement());
9449    if (json.has("type"))
9450      res.setType(parseCodeableConcept(getJObject(json, "type")));
9451    if (json.has("revenue"))
9452      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
9453    if (json.has("category"))
9454      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
9455    if (json.has("service"))
9456      res.setService(parseCodeableConcept(getJObject(json, "service")));
9457    if (json.has("modifier")) {
9458      JsonArray array = json.getAsJsonArray("modifier");
9459      for (int i = 0; i < array.size(); i++) {
9460        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9461      }
9462    };
9463    if (json.has("programCode")) {
9464      JsonArray array = json.getAsJsonArray("programCode");
9465      for (int i = 0; i < array.size(); i++) {
9466        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9467      }
9468    };
9469    if (json.has("quantity"))
9470      res.setQuantity(parseSimpleQuantity(getJObject(json, "quantity")));
9471    if (json.has("unitPrice"))
9472      res.setUnitPrice(parseMoney(getJObject(json, "unitPrice")));
9473    if (json.has("factor"))
9474      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
9475    if (json.has("_factor"))
9476      parseElementProperties(getJObject(json, "_factor"), res.getFactorElement());
9477    if (json.has("net"))
9478      res.setNet(parseMoney(getJObject(json, "net")));
9479    if (json.has("udi")) {
9480      JsonArray array = json.getAsJsonArray("udi");
9481      for (int i = 0; i < array.size(); i++) {
9482        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
9483      }
9484    };
9485    if (json.has("noteNumber")) {
9486      JsonArray array = json.getAsJsonArray("noteNumber");
9487      for (int i = 0; i < array.size(); i++) {
9488        if (array.get(i).isJsonNull()) {
9489          res.getNoteNumber().add(new PositiveIntType());
9490        } else {
9491          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
9492        }
9493      }
9494    };
9495    if (json.has("_noteNumber")) {
9496      JsonArray array = json.getAsJsonArray("_noteNumber");
9497      for (int i = 0; i < array.size(); i++) {
9498        if (i == res.getNoteNumber().size())
9499          res.getNoteNumber().add(parsePositiveInt(null));
9500        if (array.get(i) instanceof JsonObject) 
9501          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
9502      }
9503    };
9504    if (json.has("adjudication")) {
9505      JsonArray array = json.getAsJsonArray("adjudication");
9506      for (int i = 0; i < array.size(); i++) {
9507        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
9508      }
9509    };
9510  }
9511
9512  protected ExplanationOfBenefit.AddedItemComponent parseExplanationOfBenefitAddedItemComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9513    ExplanationOfBenefit.AddedItemComponent res = new ExplanationOfBenefit.AddedItemComponent();
9514    parseExplanationOfBenefitAddedItemComponentProperties(json, owner, res);
9515    return res;
9516  }
9517
9518  protected void parseExplanationOfBenefitAddedItemComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AddedItemComponent res) throws IOException, FHIRFormatError {
9519    parseBackboneProperties(json, res);
9520    if (json.has("sequenceLinkId")) {
9521      JsonArray array = json.getAsJsonArray("sequenceLinkId");
9522      for (int i = 0; i < array.size(); i++) {
9523        if (array.get(i).isJsonNull()) {
9524          res.getSequenceLinkId().add(new PositiveIntType());
9525        } else {
9526          res.getSequenceLinkId().add(parsePositiveInt(array.get(i).getAsString()));
9527        }
9528      }
9529    };
9530    if (json.has("_sequenceLinkId")) {
9531      JsonArray array = json.getAsJsonArray("_sequenceLinkId");
9532      for (int i = 0; i < array.size(); i++) {
9533        if (i == res.getSequenceLinkId().size())
9534          res.getSequenceLinkId().add(parsePositiveInt(null));
9535        if (array.get(i) instanceof JsonObject) 
9536          parseElementProperties(array.get(i).getAsJsonObject(), res.getSequenceLinkId().get(i));
9537      }
9538    };
9539    if (json.has("revenue"))
9540      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
9541    if (json.has("category"))
9542      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
9543    if (json.has("service"))
9544      res.setService(parseCodeableConcept(getJObject(json, "service")));
9545    if (json.has("modifier")) {
9546      JsonArray array = json.getAsJsonArray("modifier");
9547      for (int i = 0; i < array.size(); i++) {
9548        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9549      }
9550    };
9551    if (json.has("fee"))
9552      res.setFee(parseMoney(getJObject(json, "fee")));
9553    if (json.has("noteNumber")) {
9554      JsonArray array = json.getAsJsonArray("noteNumber");
9555      for (int i = 0; i < array.size(); i++) {
9556        if (array.get(i).isJsonNull()) {
9557          res.getNoteNumber().add(new PositiveIntType());
9558        } else {
9559          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
9560        }
9561      }
9562    };
9563    if (json.has("_noteNumber")) {
9564      JsonArray array = json.getAsJsonArray("_noteNumber");
9565      for (int i = 0; i < array.size(); i++) {
9566        if (i == res.getNoteNumber().size())
9567          res.getNoteNumber().add(parsePositiveInt(null));
9568        if (array.get(i) instanceof JsonObject) 
9569          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
9570      }
9571    };
9572    if (json.has("adjudication")) {
9573      JsonArray array = json.getAsJsonArray("adjudication");
9574      for (int i = 0; i < array.size(); i++) {
9575        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
9576      }
9577    };
9578    if (json.has("detail")) {
9579      JsonArray array = json.getAsJsonArray("detail");
9580      for (int i = 0; i < array.size(); i++) {
9581        res.getDetail().add(parseExplanationOfBenefitAddedItemsDetailComponent(array.get(i).getAsJsonObject(), owner));
9582      }
9583    };
9584  }
9585
9586  protected ExplanationOfBenefit.AddedItemsDetailComponent parseExplanationOfBenefitAddedItemsDetailComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9587    ExplanationOfBenefit.AddedItemsDetailComponent res = new ExplanationOfBenefit.AddedItemsDetailComponent();
9588    parseExplanationOfBenefitAddedItemsDetailComponentProperties(json, owner, res);
9589    return res;
9590  }
9591
9592  protected void parseExplanationOfBenefitAddedItemsDetailComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AddedItemsDetailComponent res) throws IOException, FHIRFormatError {
9593    parseBackboneProperties(json, res);
9594    if (json.has("revenue"))
9595      res.setRevenue(parseCodeableConcept(getJObject(json, "revenue")));
9596    if (json.has("category"))
9597      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
9598    if (json.has("service"))
9599      res.setService(parseCodeableConcept(getJObject(json, "service")));
9600    if (json.has("modifier")) {
9601      JsonArray array = json.getAsJsonArray("modifier");
9602      for (int i = 0; i < array.size(); i++) {
9603        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9604      }
9605    };
9606    if (json.has("fee"))
9607      res.setFee(parseMoney(getJObject(json, "fee")));
9608    if (json.has("noteNumber")) {
9609      JsonArray array = json.getAsJsonArray("noteNumber");
9610      for (int i = 0; i < array.size(); i++) {
9611        if (array.get(i).isJsonNull()) {
9612          res.getNoteNumber().add(new PositiveIntType());
9613        } else {
9614          res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
9615        }
9616      }
9617    };
9618    if (json.has("_noteNumber")) {
9619      JsonArray array = json.getAsJsonArray("_noteNumber");
9620      for (int i = 0; i < array.size(); i++) {
9621        if (i == res.getNoteNumber().size())
9622          res.getNoteNumber().add(parsePositiveInt(null));
9623        if (array.get(i) instanceof JsonObject) 
9624          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
9625      }
9626    };
9627    if (json.has("adjudication")) {
9628      JsonArray array = json.getAsJsonArray("adjudication");
9629      for (int i = 0; i < array.size(); i++) {
9630        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
9631      }
9632    };
9633  }
9634
9635  protected ExplanationOfBenefit.PaymentComponent parseExplanationOfBenefitPaymentComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9636    ExplanationOfBenefit.PaymentComponent res = new ExplanationOfBenefit.PaymentComponent();
9637    parseExplanationOfBenefitPaymentComponentProperties(json, owner, res);
9638    return res;
9639  }
9640
9641  protected void parseExplanationOfBenefitPaymentComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.PaymentComponent res) throws IOException, FHIRFormatError {
9642    parseBackboneProperties(json, res);
9643    if (json.has("type"))
9644      res.setType(parseCodeableConcept(getJObject(json, "type")));
9645    if (json.has("adjustment"))
9646      res.setAdjustment(parseMoney(getJObject(json, "adjustment")));
9647    if (json.has("adjustmentReason"))
9648      res.setAdjustmentReason(parseCodeableConcept(getJObject(json, "adjustmentReason")));
9649    if (json.has("date"))
9650      res.setDateElement(parseDate(json.get("date").getAsString()));
9651    if (json.has("_date"))
9652      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
9653    if (json.has("amount"))
9654      res.setAmount(parseMoney(getJObject(json, "amount")));
9655    if (json.has("identifier"))
9656      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
9657  }
9658
9659  protected ExplanationOfBenefit.NoteComponent parseExplanationOfBenefitNoteComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9660    ExplanationOfBenefit.NoteComponent res = new ExplanationOfBenefit.NoteComponent();
9661    parseExplanationOfBenefitNoteComponentProperties(json, owner, res);
9662    return res;
9663  }
9664
9665  protected void parseExplanationOfBenefitNoteComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.NoteComponent res) throws IOException, FHIRFormatError {
9666    parseBackboneProperties(json, res);
9667    if (json.has("number"))
9668      res.setNumberElement(parsePositiveInt(json.get("number").getAsString()));
9669    if (json.has("_number"))
9670      parseElementProperties(getJObject(json, "_number"), res.getNumberElement());
9671    if (json.has("type"))
9672      res.setType(parseCodeableConcept(getJObject(json, "type")));
9673    if (json.has("text"))
9674      res.setTextElement(parseString(json.get("text").getAsString()));
9675    if (json.has("_text"))
9676      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
9677    if (json.has("language"))
9678      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
9679  }
9680
9681  protected ExplanationOfBenefit.BenefitBalanceComponent parseExplanationOfBenefitBenefitBalanceComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9682    ExplanationOfBenefit.BenefitBalanceComponent res = new ExplanationOfBenefit.BenefitBalanceComponent();
9683    parseExplanationOfBenefitBenefitBalanceComponentProperties(json, owner, res);
9684    return res;
9685  }
9686
9687  protected void parseExplanationOfBenefitBenefitBalanceComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.BenefitBalanceComponent res) throws IOException, FHIRFormatError {
9688    parseBackboneProperties(json, res);
9689    if (json.has("category"))
9690      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
9691    if (json.has("subCategory"))
9692      res.setSubCategory(parseCodeableConcept(getJObject(json, "subCategory")));
9693    if (json.has("excluded"))
9694      res.setExcludedElement(parseBoolean(json.get("excluded").getAsBoolean()));
9695    if (json.has("_excluded"))
9696      parseElementProperties(getJObject(json, "_excluded"), res.getExcludedElement());
9697    if (json.has("name"))
9698      res.setNameElement(parseString(json.get("name").getAsString()));
9699    if (json.has("_name"))
9700      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
9701    if (json.has("description"))
9702      res.setDescriptionElement(parseString(json.get("description").getAsString()));
9703    if (json.has("_description"))
9704      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
9705    if (json.has("network"))
9706      res.setNetwork(parseCodeableConcept(getJObject(json, "network")));
9707    if (json.has("unit"))
9708      res.setUnit(parseCodeableConcept(getJObject(json, "unit")));
9709    if (json.has("term"))
9710      res.setTerm(parseCodeableConcept(getJObject(json, "term")));
9711    if (json.has("financial")) {
9712      JsonArray array = json.getAsJsonArray("financial");
9713      for (int i = 0; i < array.size(); i++) {
9714        res.getFinancial().add(parseExplanationOfBenefitBenefitComponent(array.get(i).getAsJsonObject(), owner));
9715      }
9716    };
9717  }
9718
9719  protected ExplanationOfBenefit.BenefitComponent parseExplanationOfBenefitBenefitComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9720    ExplanationOfBenefit.BenefitComponent res = new ExplanationOfBenefit.BenefitComponent();
9721    parseExplanationOfBenefitBenefitComponentProperties(json, owner, res);
9722    return res;
9723  }
9724
9725  protected void parseExplanationOfBenefitBenefitComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.BenefitComponent res) throws IOException, FHIRFormatError {
9726    parseBackboneProperties(json, res);
9727    if (json.has("type"))
9728      res.setType(parseCodeableConcept(getJObject(json, "type")));
9729    Type allowed = parseType("allowed", json);
9730    if (allowed != null)
9731      res.setAllowed(allowed);
9732    Type used = parseType("used", json);
9733    if (used != null)
9734      res.setUsed(used);
9735  }
9736
9737  protected FamilyMemberHistory parseFamilyMemberHistory(JsonObject json) throws IOException, FHIRFormatError {
9738    FamilyMemberHistory res = new FamilyMemberHistory();
9739    parseFamilyMemberHistoryProperties(json, res);
9740    return res;
9741  }
9742
9743  protected void parseFamilyMemberHistoryProperties(JsonObject json, FamilyMemberHistory res) throws IOException, FHIRFormatError {
9744    parseDomainResourceProperties(json, res);
9745    if (json.has("identifier")) {
9746      JsonArray array = json.getAsJsonArray("identifier");
9747      for (int i = 0; i < array.size(); i++) {
9748        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9749      }
9750    };
9751    if (json.has("definition")) {
9752      JsonArray array = json.getAsJsonArray("definition");
9753      for (int i = 0; i < array.size(); i++) {
9754        res.getDefinition().add(parseReference(array.get(i).getAsJsonObject()));
9755      }
9756    };
9757    if (json.has("status"))
9758      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), FamilyMemberHistory.FamilyHistoryStatus.NULL, new FamilyMemberHistory.FamilyHistoryStatusEnumFactory()));
9759    if (json.has("_status"))
9760      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
9761    if (json.has("notDone"))
9762      res.setNotDoneElement(parseBoolean(json.get("notDone").getAsBoolean()));
9763    if (json.has("_notDone"))
9764      parseElementProperties(getJObject(json, "_notDone"), res.getNotDoneElement());
9765    if (json.has("notDoneReason"))
9766      res.setNotDoneReason(parseCodeableConcept(getJObject(json, "notDoneReason")));
9767    if (json.has("patient"))
9768      res.setPatient(parseReference(getJObject(json, "patient")));
9769    if (json.has("date"))
9770      res.setDateElement(parseDateTime(json.get("date").getAsString()));
9771    if (json.has("_date"))
9772      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
9773    if (json.has("name"))
9774      res.setNameElement(parseString(json.get("name").getAsString()));
9775    if (json.has("_name"))
9776      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
9777    if (json.has("relationship"))
9778      res.setRelationship(parseCodeableConcept(getJObject(json, "relationship")));
9779    if (json.has("gender"))
9780      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
9781    if (json.has("_gender"))
9782      parseElementProperties(getJObject(json, "_gender"), res.getGenderElement());
9783    Type born = parseType("born", json);
9784    if (born != null)
9785      res.setBorn(born);
9786    Type age = parseType("age", json);
9787    if (age != null)
9788      res.setAge(age);
9789    if (json.has("estimatedAge"))
9790      res.setEstimatedAgeElement(parseBoolean(json.get("estimatedAge").getAsBoolean()));
9791    if (json.has("_estimatedAge"))
9792      parseElementProperties(getJObject(json, "_estimatedAge"), res.getEstimatedAgeElement());
9793    Type deceased = parseType("deceased", json);
9794    if (deceased != null)
9795      res.setDeceased(deceased);
9796    if (json.has("reasonCode")) {
9797      JsonArray array = json.getAsJsonArray("reasonCode");
9798      for (int i = 0; i < array.size(); i++) {
9799        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9800      }
9801    };
9802    if (json.has("reasonReference")) {
9803      JsonArray array = json.getAsJsonArray("reasonReference");
9804      for (int i = 0; i < array.size(); i++) {
9805        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
9806      }
9807    };
9808    if (json.has("note")) {
9809      JsonArray array = json.getAsJsonArray("note");
9810      for (int i = 0; i < array.size(); i++) {
9811        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
9812      }
9813    };
9814    if (json.has("condition")) {
9815      JsonArray array = json.getAsJsonArray("condition");
9816      for (int i = 0; i < array.size(); i++) {
9817        res.getCondition().add(parseFamilyMemberHistoryFamilyMemberHistoryConditionComponent(array.get(i).getAsJsonObject(), res));
9818      }
9819    };
9820  }
9821
9822  protected FamilyMemberHistory.FamilyMemberHistoryConditionComponent parseFamilyMemberHistoryFamilyMemberHistoryConditionComponent(JsonObject json, FamilyMemberHistory owner) throws IOException, FHIRFormatError {
9823    FamilyMemberHistory.FamilyMemberHistoryConditionComponent res = new FamilyMemberHistory.FamilyMemberHistoryConditionComponent();
9824    parseFamilyMemberHistoryFamilyMemberHistoryConditionComponentProperties(json, owner, res);
9825    return res;
9826  }
9827
9828  protected void parseFamilyMemberHistoryFamilyMemberHistoryConditionComponentProperties(JsonObject json, FamilyMemberHistory owner, FamilyMemberHistory.FamilyMemberHistoryConditionComponent res) throws IOException, FHIRFormatError {
9829    parseBackboneProperties(json, res);
9830    if (json.has("code"))
9831      res.setCode(parseCodeableConcept(getJObject(json, "code")));
9832    if (json.has("outcome"))
9833      res.setOutcome(parseCodeableConcept(getJObject(json, "outcome")));
9834    Type onset = parseType("onset", json);
9835    if (onset != null)
9836      res.setOnset(onset);
9837    if (json.has("note")) {
9838      JsonArray array = json.getAsJsonArray("note");
9839      for (int i = 0; i < array.size(); i++) {
9840        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
9841      }
9842    };
9843  }
9844
9845  protected Flag parseFlag(JsonObject json) throws IOException, FHIRFormatError {
9846    Flag res = new Flag();
9847    parseFlagProperties(json, res);
9848    return res;
9849  }
9850
9851  protected void parseFlagProperties(JsonObject json, Flag res) throws IOException, FHIRFormatError {
9852    parseDomainResourceProperties(json, res);
9853    if (json.has("identifier")) {
9854      JsonArray array = json.getAsJsonArray("identifier");
9855      for (int i = 0; i < array.size(); i++) {
9856        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9857      }
9858    };
9859    if (json.has("status"))
9860      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Flag.FlagStatus.NULL, new Flag.FlagStatusEnumFactory()));
9861    if (json.has("_status"))
9862      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
9863    if (json.has("category"))
9864      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
9865    if (json.has("code"))
9866      res.setCode(parseCodeableConcept(getJObject(json, "code")));
9867    if (json.has("subject"))
9868      res.setSubject(parseReference(getJObject(json, "subject")));
9869    if (json.has("period"))
9870      res.setPeriod(parsePeriod(getJObject(json, "period")));
9871    if (json.has("encounter"))
9872      res.setEncounter(parseReference(getJObject(json, "encounter")));
9873    if (json.has("author"))
9874      res.setAuthor(parseReference(getJObject(json, "author")));
9875  }
9876
9877  protected Goal parseGoal(JsonObject json) throws IOException, FHIRFormatError {
9878    Goal res = new Goal();
9879    parseGoalProperties(json, res);
9880    return res;
9881  }
9882
9883  protected void parseGoalProperties(JsonObject json, Goal res) throws IOException, FHIRFormatError {
9884    parseDomainResourceProperties(json, res);
9885    if (json.has("identifier")) {
9886      JsonArray array = json.getAsJsonArray("identifier");
9887      for (int i = 0; i < array.size(); i++) {
9888        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9889      }
9890    };
9891    if (json.has("status"))
9892      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Goal.GoalStatus.NULL, new Goal.GoalStatusEnumFactory()));
9893    if (json.has("_status"))
9894      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
9895    if (json.has("category")) {
9896      JsonArray array = json.getAsJsonArray("category");
9897      for (int i = 0; i < array.size(); i++) {
9898        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9899      }
9900    };
9901    if (json.has("priority"))
9902      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
9903    if (json.has("description"))
9904      res.setDescription(parseCodeableConcept(getJObject(json, "description")));
9905    if (json.has("subject"))
9906      res.setSubject(parseReference(getJObject(json, "subject")));
9907    Type start = parseType("start", json);
9908    if (start != null)
9909      res.setStart(start);
9910    if (json.has("target"))
9911      res.setTarget(parseGoalGoalTargetComponent(getJObject(json, "target"), res));
9912    if (json.has("statusDate"))
9913      res.setStatusDateElement(parseDate(json.get("statusDate").getAsString()));
9914    if (json.has("_statusDate"))
9915      parseElementProperties(getJObject(json, "_statusDate"), res.getStatusDateElement());
9916    if (json.has("statusReason"))
9917      res.setStatusReasonElement(parseString(json.get("statusReason").getAsString()));
9918    if (json.has("_statusReason"))
9919      parseElementProperties(getJObject(json, "_statusReason"), res.getStatusReasonElement());
9920    if (json.has("expressedBy"))
9921      res.setExpressedBy(parseReference(getJObject(json, "expressedBy")));
9922    if (json.has("addresses")) {
9923      JsonArray array = json.getAsJsonArray("addresses");
9924      for (int i = 0; i < array.size(); i++) {
9925        res.getAddresses().add(parseReference(array.get(i).getAsJsonObject()));
9926      }
9927    };
9928    if (json.has("note")) {
9929      JsonArray array = json.getAsJsonArray("note");
9930      for (int i = 0; i < array.size(); i++) {
9931        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
9932      }
9933    };
9934    if (json.has("outcomeCode")) {
9935      JsonArray array = json.getAsJsonArray("outcomeCode");
9936      for (int i = 0; i < array.size(); i++) {
9937        res.getOutcomeCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9938      }
9939    };
9940    if (json.has("outcomeReference")) {
9941      JsonArray array = json.getAsJsonArray("outcomeReference");
9942      for (int i = 0; i < array.size(); i++) {
9943        res.getOutcomeReference().add(parseReference(array.get(i).getAsJsonObject()));
9944      }
9945    };
9946  }
9947
9948  protected Goal.GoalTargetComponent parseGoalGoalTargetComponent(JsonObject json, Goal owner) throws IOException, FHIRFormatError {
9949    Goal.GoalTargetComponent res = new Goal.GoalTargetComponent();
9950    parseGoalGoalTargetComponentProperties(json, owner, res);
9951    return res;
9952  }
9953
9954  protected void parseGoalGoalTargetComponentProperties(JsonObject json, Goal owner, Goal.GoalTargetComponent res) throws IOException, FHIRFormatError {
9955    parseBackboneProperties(json, res);
9956    if (json.has("measure"))
9957      res.setMeasure(parseCodeableConcept(getJObject(json, "measure")));
9958    Type detail = parseType("detail", json);
9959    if (detail != null)
9960      res.setDetail(detail);
9961    Type due = parseType("due", json);
9962    if (due != null)
9963      res.setDue(due);
9964  }
9965
9966  protected GraphDefinition parseGraphDefinition(JsonObject json) throws IOException, FHIRFormatError {
9967    GraphDefinition res = new GraphDefinition();
9968    parseGraphDefinitionProperties(json, res);
9969    return res;
9970  }
9971
9972  protected void parseGraphDefinitionProperties(JsonObject json, GraphDefinition res) throws IOException, FHIRFormatError {
9973    parseDomainResourceProperties(json, res);
9974    if (json.has("url"))
9975      res.setUrlElement(parseUri(json.get("url").getAsString()));
9976    if (json.has("_url"))
9977      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
9978    if (json.has("version"))
9979      res.setVersionElement(parseString(json.get("version").getAsString()));
9980    if (json.has("_version"))
9981      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
9982    if (json.has("name"))
9983      res.setNameElement(parseString(json.get("name").getAsString()));
9984    if (json.has("_name"))
9985      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
9986    if (json.has("status"))
9987      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
9988    if (json.has("_status"))
9989      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
9990    if (json.has("experimental"))
9991      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
9992    if (json.has("_experimental"))
9993      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
9994    if (json.has("date"))
9995      res.setDateElement(parseDateTime(json.get("date").getAsString()));
9996    if (json.has("_date"))
9997      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
9998    if (json.has("publisher"))
9999      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
10000    if (json.has("_publisher"))
10001      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
10002    if (json.has("contact")) {
10003      JsonArray array = json.getAsJsonArray("contact");
10004      for (int i = 0; i < array.size(); i++) {
10005        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
10006      }
10007    };
10008    if (json.has("description"))
10009      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
10010    if (json.has("_description"))
10011      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
10012    if (json.has("useContext")) {
10013      JsonArray array = json.getAsJsonArray("useContext");
10014      for (int i = 0; i < array.size(); i++) {
10015        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
10016      }
10017    };
10018    if (json.has("jurisdiction")) {
10019      JsonArray array = json.getAsJsonArray("jurisdiction");
10020      for (int i = 0; i < array.size(); i++) {
10021        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10022      }
10023    };
10024    if (json.has("purpose"))
10025      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
10026    if (json.has("_purpose"))
10027      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
10028    if (json.has("start"))
10029      res.setStartElement(parseCode(json.get("start").getAsString()));
10030    if (json.has("_start"))
10031      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
10032    if (json.has("profile"))
10033      res.setProfileElement(parseUri(json.get("profile").getAsString()));
10034    if (json.has("_profile"))
10035      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
10036    if (json.has("link")) {
10037      JsonArray array = json.getAsJsonArray("link");
10038      for (int i = 0; i < array.size(); i++) {
10039        res.getLink().add(parseGraphDefinitionGraphDefinitionLinkComponent(array.get(i).getAsJsonObject(), res));
10040      }
10041    };
10042  }
10043
10044  protected GraphDefinition.GraphDefinitionLinkComponent parseGraphDefinitionGraphDefinitionLinkComponent(JsonObject json, GraphDefinition owner) throws IOException, FHIRFormatError {
10045    GraphDefinition.GraphDefinitionLinkComponent res = new GraphDefinition.GraphDefinitionLinkComponent();
10046    parseGraphDefinitionGraphDefinitionLinkComponentProperties(json, owner, res);
10047    return res;
10048  }
10049
10050  protected void parseGraphDefinitionGraphDefinitionLinkComponentProperties(JsonObject json, GraphDefinition owner, GraphDefinition.GraphDefinitionLinkComponent res) throws IOException, FHIRFormatError {
10051    parseBackboneProperties(json, res);
10052    if (json.has("path"))
10053      res.setPathElement(parseString(json.get("path").getAsString()));
10054    if (json.has("_path"))
10055      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
10056    if (json.has("sliceName"))
10057      res.setSliceNameElement(parseString(json.get("sliceName").getAsString()));
10058    if (json.has("_sliceName"))
10059      parseElementProperties(getJObject(json, "_sliceName"), res.getSliceNameElement());
10060    if (json.has("min"))
10061      res.setMinElement(parseInteger(json.get("min").getAsLong()));
10062    if (json.has("_min"))
10063      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
10064    if (json.has("max"))
10065      res.setMaxElement(parseString(json.get("max").getAsString()));
10066    if (json.has("_max"))
10067      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
10068    if (json.has("description"))
10069      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10070    if (json.has("_description"))
10071      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
10072    if (json.has("target")) {
10073      JsonArray array = json.getAsJsonArray("target");
10074      for (int i = 0; i < array.size(); i++) {
10075        res.getTarget().add(parseGraphDefinitionGraphDefinitionLinkTargetComponent(array.get(i).getAsJsonObject(), owner));
10076      }
10077    };
10078  }
10079
10080  protected GraphDefinition.GraphDefinitionLinkTargetComponent parseGraphDefinitionGraphDefinitionLinkTargetComponent(JsonObject json, GraphDefinition owner) throws IOException, FHIRFormatError {
10081    GraphDefinition.GraphDefinitionLinkTargetComponent res = new GraphDefinition.GraphDefinitionLinkTargetComponent();
10082    parseGraphDefinitionGraphDefinitionLinkTargetComponentProperties(json, owner, res);
10083    return res;
10084  }
10085
10086  protected void parseGraphDefinitionGraphDefinitionLinkTargetComponentProperties(JsonObject json, GraphDefinition owner, GraphDefinition.GraphDefinitionLinkTargetComponent res) throws IOException, FHIRFormatError {
10087    parseBackboneProperties(json, res);
10088    if (json.has("type"))
10089      res.setTypeElement(parseCode(json.get("type").getAsString()));
10090    if (json.has("_type"))
10091      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
10092    if (json.has("profile"))
10093      res.setProfileElement(parseUri(json.get("profile").getAsString()));
10094    if (json.has("_profile"))
10095      parseElementProperties(getJObject(json, "_profile"), res.getProfileElement());
10096    if (json.has("compartment")) {
10097      JsonArray array = json.getAsJsonArray("compartment");
10098      for (int i = 0; i < array.size(); i++) {
10099        res.getCompartment().add(parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(array.get(i).getAsJsonObject(), owner));
10100      }
10101    };
10102    if (json.has("link")) {
10103      JsonArray array = json.getAsJsonArray("link");
10104      for (int i = 0; i < array.size(); i++) {
10105        res.getLink().add(parseGraphDefinitionGraphDefinitionLinkComponent(array.get(i).getAsJsonObject(), owner));
10106      }
10107    };
10108  }
10109
10110  protected GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(JsonObject json, GraphDefinition owner) throws IOException, FHIRFormatError {
10111    GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent res = new GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent();
10112    parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentProperties(json, owner, res);
10113    return res;
10114  }
10115
10116  protected void parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentProperties(JsonObject json, GraphDefinition owner, GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent res) throws IOException, FHIRFormatError {
10117    parseBackboneProperties(json, res);
10118    if (json.has("code"))
10119      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), GraphDefinition.CompartmentCode.NULL, new GraphDefinition.CompartmentCodeEnumFactory()));
10120    if (json.has("_code"))
10121      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
10122    if (json.has("rule"))
10123      res.setRuleElement(parseEnumeration(json.get("rule").getAsString(), GraphDefinition.GraphCompartmentRule.NULL, new GraphDefinition.GraphCompartmentRuleEnumFactory()));
10124    if (json.has("_rule"))
10125      parseElementProperties(getJObject(json, "_rule"), res.getRuleElement());
10126    if (json.has("expression"))
10127      res.setExpressionElement(parseString(json.get("expression").getAsString()));
10128    if (json.has("_expression"))
10129      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
10130    if (json.has("description"))
10131      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10132    if (json.has("_description"))
10133      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
10134  }
10135
10136  protected Group parseGroup(JsonObject json) throws IOException, FHIRFormatError {
10137    Group res = new Group();
10138    parseGroupProperties(json, res);
10139    return res;
10140  }
10141
10142  protected void parseGroupProperties(JsonObject json, Group res) throws IOException, FHIRFormatError {
10143    parseDomainResourceProperties(json, res);
10144    if (json.has("identifier")) {
10145      JsonArray array = json.getAsJsonArray("identifier");
10146      for (int i = 0; i < array.size(); i++) {
10147        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10148      }
10149    };
10150    if (json.has("active"))
10151      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
10152    if (json.has("_active"))
10153      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
10154    if (json.has("type"))
10155      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Group.GroupType.NULL, new Group.GroupTypeEnumFactory()));
10156    if (json.has("_type"))
10157      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
10158    if (json.has("actual"))
10159      res.setActualElement(parseBoolean(json.get("actual").getAsBoolean()));
10160    if (json.has("_actual"))
10161      parseElementProperties(getJObject(json, "_actual"), res.getActualElement());
10162    if (json.has("code"))
10163      res.setCode(parseCodeableConcept(getJObject(json, "code")));
10164    if (json.has("name"))
10165      res.setNameElement(parseString(json.get("name").getAsString()));
10166    if (json.has("_name"))
10167      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
10168    if (json.has("quantity"))
10169      res.setQuantityElement(parseUnsignedInt(json.get("quantity").getAsString()));
10170    if (json.has("_quantity"))
10171      parseElementProperties(getJObject(json, "_quantity"), res.getQuantityElement());
10172    if (json.has("characteristic")) {
10173      JsonArray array = json.getAsJsonArray("characteristic");
10174      for (int i = 0; i < array.size(); i++) {
10175        res.getCharacteristic().add(parseGroupGroupCharacteristicComponent(array.get(i).getAsJsonObject(), res));
10176      }
10177    };
10178    if (json.has("member")) {
10179      JsonArray array = json.getAsJsonArray("member");
10180      for (int i = 0; i < array.size(); i++) {
10181        res.getMember().add(parseGroupGroupMemberComponent(array.get(i).getAsJsonObject(), res));
10182      }
10183    };
10184  }
10185
10186  protected Group.GroupCharacteristicComponent parseGroupGroupCharacteristicComponent(JsonObject json, Group owner) throws IOException, FHIRFormatError {
10187    Group.GroupCharacteristicComponent res = new Group.GroupCharacteristicComponent();
10188    parseGroupGroupCharacteristicComponentProperties(json, owner, res);
10189    return res;
10190  }
10191
10192  protected void parseGroupGroupCharacteristicComponentProperties(JsonObject json, Group owner, Group.GroupCharacteristicComponent res) throws IOException, FHIRFormatError {
10193    parseBackboneProperties(json, res);
10194    if (json.has("code"))
10195      res.setCode(parseCodeableConcept(getJObject(json, "code")));
10196    Type value = parseType("value", json);
10197    if (value != null)
10198      res.setValue(value);
10199    if (json.has("exclude"))
10200      res.setExcludeElement(parseBoolean(json.get("exclude").getAsBoolean()));
10201    if (json.has("_exclude"))
10202      parseElementProperties(getJObject(json, "_exclude"), res.getExcludeElement());
10203    if (json.has("period"))
10204      res.setPeriod(parsePeriod(getJObject(json, "period")));
10205  }
10206
10207  protected Group.GroupMemberComponent parseGroupGroupMemberComponent(JsonObject json, Group owner) throws IOException, FHIRFormatError {
10208    Group.GroupMemberComponent res = new Group.GroupMemberComponent();
10209    parseGroupGroupMemberComponentProperties(json, owner, res);
10210    return res;
10211  }
10212
10213  protected void parseGroupGroupMemberComponentProperties(JsonObject json, Group owner, Group.GroupMemberComponent res) throws IOException, FHIRFormatError {
10214    parseBackboneProperties(json, res);
10215    if (json.has("entity"))
10216      res.setEntity(parseReference(getJObject(json, "entity")));
10217    if (json.has("period"))
10218      res.setPeriod(parsePeriod(getJObject(json, "period")));
10219    if (json.has("inactive"))
10220      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
10221    if (json.has("_inactive"))
10222      parseElementProperties(getJObject(json, "_inactive"), res.getInactiveElement());
10223  }
10224
10225  protected GuidanceResponse parseGuidanceResponse(JsonObject json) throws IOException, FHIRFormatError {
10226    GuidanceResponse res = new GuidanceResponse();
10227    parseGuidanceResponseProperties(json, res);
10228    return res;
10229  }
10230
10231  protected void parseGuidanceResponseProperties(JsonObject json, GuidanceResponse res) throws IOException, FHIRFormatError {
10232    parseDomainResourceProperties(json, res);
10233    if (json.has("requestId"))
10234      res.setRequestIdElement(parseId(json.get("requestId").getAsString()));
10235    if (json.has("_requestId"))
10236      parseElementProperties(getJObject(json, "_requestId"), res.getRequestIdElement());
10237    if (json.has("identifier"))
10238      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
10239    if (json.has("module"))
10240      res.setModule(parseReference(getJObject(json, "module")));
10241    if (json.has("status"))
10242      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), GuidanceResponse.GuidanceResponseStatus.NULL, new GuidanceResponse.GuidanceResponseStatusEnumFactory()));
10243    if (json.has("_status"))
10244      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
10245    if (json.has("subject"))
10246      res.setSubject(parseReference(getJObject(json, "subject")));
10247    if (json.has("context"))
10248      res.setContext(parseReference(getJObject(json, "context")));
10249    if (json.has("occurrenceDateTime"))
10250      res.setOccurrenceDateTimeElement(parseDateTime(json.get("occurrenceDateTime").getAsString()));
10251    if (json.has("_occurrenceDateTime"))
10252      parseElementProperties(getJObject(json, "_occurrenceDateTime"), res.getOccurrenceDateTimeElement());
10253    if (json.has("performer"))
10254      res.setPerformer(parseReference(getJObject(json, "performer")));
10255    Type reason = parseType("reason", json);
10256    if (reason != null)
10257      res.setReason(reason);
10258    if (json.has("note")) {
10259      JsonArray array = json.getAsJsonArray("note");
10260      for (int i = 0; i < array.size(); i++) {
10261        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
10262      }
10263    };
10264    if (json.has("evaluationMessage")) {
10265      JsonArray array = json.getAsJsonArray("evaluationMessage");
10266      for (int i = 0; i < array.size(); i++) {
10267        res.getEvaluationMessage().add(parseReference(array.get(i).getAsJsonObject()));
10268      }
10269    };
10270    if (json.has("outputParameters"))
10271      res.setOutputParameters(parseReference(getJObject(json, "outputParameters")));
10272    if (json.has("result"))
10273      res.setResult(parseReference(getJObject(json, "result")));
10274    if (json.has("dataRequirement")) {
10275      JsonArray array = json.getAsJsonArray("dataRequirement");
10276      for (int i = 0; i < array.size(); i++) {
10277        res.getDataRequirement().add(parseDataRequirement(array.get(i).getAsJsonObject()));
10278      }
10279    };
10280  }
10281
10282  protected HealthcareService parseHealthcareService(JsonObject json) throws IOException, FHIRFormatError {
10283    HealthcareService res = new HealthcareService();
10284    parseHealthcareServiceProperties(json, res);
10285    return res;
10286  }
10287
10288  protected void parseHealthcareServiceProperties(JsonObject json, HealthcareService res) throws IOException, FHIRFormatError {
10289    parseDomainResourceProperties(json, res);
10290    if (json.has("identifier")) {
10291      JsonArray array = json.getAsJsonArray("identifier");
10292      for (int i = 0; i < array.size(); i++) {
10293        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10294      }
10295    };
10296    if (json.has("active"))
10297      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
10298    if (json.has("_active"))
10299      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
10300    if (json.has("providedBy"))
10301      res.setProvidedBy(parseReference(getJObject(json, "providedBy")));
10302    if (json.has("category"))
10303      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
10304    if (json.has("type")) {
10305      JsonArray array = json.getAsJsonArray("type");
10306      for (int i = 0; i < array.size(); i++) {
10307        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10308      }
10309    };
10310    if (json.has("specialty")) {
10311      JsonArray array = json.getAsJsonArray("specialty");
10312      for (int i = 0; i < array.size(); i++) {
10313        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10314      }
10315    };
10316    if (json.has("location")) {
10317      JsonArray array = json.getAsJsonArray("location");
10318      for (int i = 0; i < array.size(); i++) {
10319        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
10320      }
10321    };
10322    if (json.has("name"))
10323      res.setNameElement(parseString(json.get("name").getAsString()));
10324    if (json.has("_name"))
10325      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
10326    if (json.has("comment"))
10327      res.setCommentElement(parseString(json.get("comment").getAsString()));
10328    if (json.has("_comment"))
10329      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
10330    if (json.has("extraDetails"))
10331      res.setExtraDetailsElement(parseString(json.get("extraDetails").getAsString()));
10332    if (json.has("_extraDetails"))
10333      parseElementProperties(getJObject(json, "_extraDetails"), res.getExtraDetailsElement());
10334    if (json.has("photo"))
10335      res.setPhoto(parseAttachment(getJObject(json, "photo")));
10336    if (json.has("telecom")) {
10337      JsonArray array = json.getAsJsonArray("telecom");
10338      for (int i = 0; i < array.size(); i++) {
10339        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
10340      }
10341    };
10342    if (json.has("coverageArea")) {
10343      JsonArray array = json.getAsJsonArray("coverageArea");
10344      for (int i = 0; i < array.size(); i++) {
10345        res.getCoverageArea().add(parseReference(array.get(i).getAsJsonObject()));
10346      }
10347    };
10348    if (json.has("serviceProvisionCode")) {
10349      JsonArray array = json.getAsJsonArray("serviceProvisionCode");
10350      for (int i = 0; i < array.size(); i++) {
10351        res.getServiceProvisionCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10352      }
10353    };
10354    if (json.has("eligibility"))
10355      res.setEligibility(parseCodeableConcept(getJObject(json, "eligibility")));
10356    if (json.has("eligibilityNote"))
10357      res.setEligibilityNoteElement(parseString(json.get("eligibilityNote").getAsString()));
10358    if (json.has("_eligibilityNote"))
10359      parseElementProperties(getJObject(json, "_eligibilityNote"), res.getEligibilityNoteElement());
10360    if (json.has("programName")) {
10361      JsonArray array = json.getAsJsonArray("programName");
10362      for (int i = 0; i < array.size(); i++) {
10363        if (array.get(i).isJsonNull()) {
10364          res.getProgramName().add(new StringType());
10365        } else {
10366          res.getProgramName().add(parseString(array.get(i).getAsString()));
10367        }
10368      }
10369    };
10370    if (json.has("_programName")) {
10371      JsonArray array = json.getAsJsonArray("_programName");
10372      for (int i = 0; i < array.size(); i++) {
10373        if (i == res.getProgramName().size())
10374          res.getProgramName().add(parseString(null));
10375        if (array.get(i) instanceof JsonObject) 
10376          parseElementProperties(array.get(i).getAsJsonObject(), res.getProgramName().get(i));
10377      }
10378    };
10379    if (json.has("characteristic")) {
10380      JsonArray array = json.getAsJsonArray("characteristic");
10381      for (int i = 0; i < array.size(); i++) {
10382        res.getCharacteristic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10383      }
10384    };
10385    if (json.has("referralMethod")) {
10386      JsonArray array = json.getAsJsonArray("referralMethod");
10387      for (int i = 0; i < array.size(); i++) {
10388        res.getReferralMethod().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10389      }
10390    };
10391    if (json.has("appointmentRequired"))
10392      res.setAppointmentRequiredElement(parseBoolean(json.get("appointmentRequired").getAsBoolean()));
10393    if (json.has("_appointmentRequired"))
10394      parseElementProperties(getJObject(json, "_appointmentRequired"), res.getAppointmentRequiredElement());
10395    if (json.has("availableTime")) {
10396      JsonArray array = json.getAsJsonArray("availableTime");
10397      for (int i = 0; i < array.size(); i++) {
10398        res.getAvailableTime().add(parseHealthcareServiceHealthcareServiceAvailableTimeComponent(array.get(i).getAsJsonObject(), res));
10399      }
10400    };
10401    if (json.has("notAvailable")) {
10402      JsonArray array = json.getAsJsonArray("notAvailable");
10403      for (int i = 0; i < array.size(); i++) {
10404        res.getNotAvailable().add(parseHealthcareServiceHealthcareServiceNotAvailableComponent(array.get(i).getAsJsonObject(), res));
10405      }
10406    };
10407    if (json.has("availabilityExceptions"))
10408      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
10409    if (json.has("_availabilityExceptions"))
10410      parseElementProperties(getJObject(json, "_availabilityExceptions"), res.getAvailabilityExceptionsElement());
10411    if (json.has("endpoint")) {
10412      JsonArray array = json.getAsJsonArray("endpoint");
10413      for (int i = 0; i < array.size(); i++) {
10414        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
10415      }
10416    };
10417  }
10418
10419  protected HealthcareService.HealthcareServiceAvailableTimeComponent parseHealthcareServiceHealthcareServiceAvailableTimeComponent(JsonObject json, HealthcareService owner) throws IOException, FHIRFormatError {
10420    HealthcareService.HealthcareServiceAvailableTimeComponent res = new HealthcareService.HealthcareServiceAvailableTimeComponent();
10421    parseHealthcareServiceHealthcareServiceAvailableTimeComponentProperties(json, owner, res);
10422    return res;
10423  }
10424
10425  protected void parseHealthcareServiceHealthcareServiceAvailableTimeComponentProperties(JsonObject json, HealthcareService owner, HealthcareService.HealthcareServiceAvailableTimeComponent res) throws IOException, FHIRFormatError {
10426    parseBackboneProperties(json, res);
10427    if (json.has("daysOfWeek")) {
10428      JsonArray array = json.getAsJsonArray("daysOfWeek");
10429      for (int i = 0; i < array.size(); i++) {
10430        if (array.get(i).isJsonNull()) {
10431          res.getDaysOfWeek().add(new Enumeration<HealthcareService.DaysOfWeek>());
10432        } else {
10433          res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), HealthcareService.DaysOfWeek.NULL, new HealthcareService.DaysOfWeekEnumFactory()));
10434        }
10435      }
10436    };
10437    if (json.has("_daysOfWeek")) {
10438      JsonArray array = json.getAsJsonArray("_daysOfWeek");
10439      for (int i = 0; i < array.size(); i++) {
10440        if (i == res.getDaysOfWeek().size())
10441          res.getDaysOfWeek().add(parseEnumeration(null, HealthcareService.DaysOfWeek.NULL, new HealthcareService.DaysOfWeekEnumFactory()));
10442        if (array.get(i) instanceof JsonObject) 
10443          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
10444      }
10445    };
10446    if (json.has("allDay"))
10447      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
10448    if (json.has("_allDay"))
10449      parseElementProperties(getJObject(json, "_allDay"), res.getAllDayElement());
10450    if (json.has("availableStartTime"))
10451      res.setAvailableStartTimeElement(parseTime(json.get("availableStartTime").getAsString()));
10452    if (json.has("_availableStartTime"))
10453      parseElementProperties(getJObject(json, "_availableStartTime"), res.getAvailableStartTimeElement());
10454    if (json.has("availableEndTime"))
10455      res.setAvailableEndTimeElement(parseTime(json.get("availableEndTime").getAsString()));
10456    if (json.has("_availableEndTime"))
10457      parseElementProperties(getJObject(json, "_availableEndTime"), res.getAvailableEndTimeElement());
10458  }
10459
10460  protected HealthcareService.HealthcareServiceNotAvailableComponent parseHealthcareServiceHealthcareServiceNotAvailableComponent(JsonObject json, HealthcareService owner) throws IOException, FHIRFormatError {
10461    HealthcareService.HealthcareServiceNotAvailableComponent res = new HealthcareService.HealthcareServiceNotAvailableComponent();
10462    parseHealthcareServiceHealthcareServiceNotAvailableComponentProperties(json, owner, res);
10463    return res;
10464  }
10465
10466  protected void parseHealthcareServiceHealthcareServiceNotAvailableComponentProperties(JsonObject json, HealthcareService owner, HealthcareService.HealthcareServiceNotAvailableComponent res) throws IOException, FHIRFormatError {
10467    parseBackboneProperties(json, res);
10468    if (json.has("description"))
10469      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10470    if (json.has("_description"))
10471      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
10472    if (json.has("during"))
10473      res.setDuring(parsePeriod(getJObject(json, "during")));
10474  }
10475
10476  protected ImagingManifest parseImagingManifest(JsonObject json) throws IOException, FHIRFormatError {
10477    ImagingManifest res = new ImagingManifest();
10478    parseImagingManifestProperties(json, res);
10479    return res;
10480  }
10481
10482  protected void parseImagingManifestProperties(JsonObject json, ImagingManifest res) throws IOException, FHIRFormatError {
10483    parseDomainResourceProperties(json, res);
10484    if (json.has("identifier"))
10485      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
10486    if (json.has("patient"))
10487      res.setPatient(parseReference(getJObject(json, "patient")));
10488    if (json.has("authoringTime"))
10489      res.setAuthoringTimeElement(parseDateTime(json.get("authoringTime").getAsString()));
10490    if (json.has("_authoringTime"))
10491      parseElementProperties(getJObject(json, "_authoringTime"), res.getAuthoringTimeElement());
10492    if (json.has("author"))
10493      res.setAuthor(parseReference(getJObject(json, "author")));
10494    if (json.has("description"))
10495      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10496    if (json.has("_description"))
10497      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
10498    if (json.has("study")) {
10499      JsonArray array = json.getAsJsonArray("study");
10500      for (int i = 0; i < array.size(); i++) {
10501        res.getStudy().add(parseImagingManifestStudyComponent(array.get(i).getAsJsonObject(), res));
10502      }
10503    };
10504  }
10505
10506  protected ImagingManifest.StudyComponent parseImagingManifestStudyComponent(JsonObject json, ImagingManifest owner) throws IOException, FHIRFormatError {
10507    ImagingManifest.StudyComponent res = new ImagingManifest.StudyComponent();
10508    parseImagingManifestStudyComponentProperties(json, owner, res);
10509    return res;
10510  }
10511
10512  protected void parseImagingManifestStudyComponentProperties(JsonObject json, ImagingManifest owner, ImagingManifest.StudyComponent res) throws IOException, FHIRFormatError {
10513    parseBackboneProperties(json, res);
10514    if (json.has("uid"))
10515      res.setUidElement(parseOid(json.get("uid").getAsString()));
10516    if (json.has("_uid"))
10517      parseElementProperties(getJObject(json, "_uid"), res.getUidElement());
10518    if (json.has("imagingStudy"))
10519      res.setImagingStudy(parseReference(getJObject(json, "imagingStudy")));
10520    if (json.has("endpoint")) {
10521      JsonArray array = json.getAsJsonArray("endpoint");
10522      for (int i = 0; i < array.size(); i++) {
10523        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
10524      }
10525    };
10526    if (json.has("series")) {
10527      JsonArray array = json.getAsJsonArray("series");
10528      for (int i = 0; i < array.size(); i++) {
10529        res.getSeries().add(parseImagingManifestSeriesComponent(array.get(i).getAsJsonObject(), owner));
10530      }
10531    };
10532  }
10533
10534  protected ImagingManifest.SeriesComponent parseImagingManifestSeriesComponent(JsonObject json, ImagingManifest owner) throws IOException, FHIRFormatError {
10535    ImagingManifest.SeriesComponent res = new ImagingManifest.SeriesComponent();
10536    parseImagingManifestSeriesComponentProperties(json, owner, res);
10537    return res;
10538  }
10539
10540  protected void parseImagingManifestSeriesComponentProperties(JsonObject json, ImagingManifest owner, ImagingManifest.SeriesComponent res) throws IOException, FHIRFormatError {
10541    parseBackboneProperties(json, res);
10542    if (json.has("uid"))
10543      res.setUidElement(parseOid(json.get("uid").getAsString()));
10544    if (json.has("_uid"))
10545      parseElementProperties(getJObject(json, "_uid"), res.getUidElement());
10546    if (json.has("endpoint")) {
10547      JsonArray array = json.getAsJsonArray("endpoint");
10548      for (int i = 0; i < array.size(); i++) {
10549        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
10550      }
10551    };
10552    if (json.has("instance")) {
10553      JsonArray array = json.getAsJsonArray("instance");
10554      for (int i = 0; i < array.size(); i++) {
10555        res.getInstance().add(parseImagingManifestInstanceComponent(array.get(i).getAsJsonObject(), owner));
10556      }
10557    };
10558  }
10559
10560  protected ImagingManifest.InstanceComponent parseImagingManifestInstanceComponent(JsonObject json, ImagingManifest owner) throws IOException, FHIRFormatError {
10561    ImagingManifest.InstanceComponent res = new ImagingManifest.InstanceComponent();
10562    parseImagingManifestInstanceComponentProperties(json, owner, res);
10563    return res;
10564  }
10565
10566  protected void parseImagingManifestInstanceComponentProperties(JsonObject json, ImagingManifest owner, ImagingManifest.InstanceComponent res) throws IOException, FHIRFormatError {
10567    parseBackboneProperties(json, res);
10568    if (json.has("sopClass"))
10569      res.setSopClassElement(parseOid(json.get("sopClass").getAsString()));
10570    if (json.has("_sopClass"))
10571      parseElementProperties(getJObject(json, "_sopClass"), res.getSopClassElement());
10572    if (json.has("uid"))
10573      res.setUidElement(parseOid(json.get("uid").getAsString()));
10574    if (json.has("_uid"))
10575      parseElementProperties(getJObject(json, "_uid"), res.getUidElement());
10576  }
10577
10578  protected ImagingStudy parseImagingStudy(JsonObject json) throws IOException, FHIRFormatError {
10579    ImagingStudy res = new ImagingStudy();
10580    parseImagingStudyProperties(json, res);
10581    return res;
10582  }
10583
10584  protected void parseImagingStudyProperties(JsonObject json, ImagingStudy res) throws IOException, FHIRFormatError {
10585    parseDomainResourceProperties(json, res);
10586    if (json.has("uid"))
10587      res.setUidElement(parseOid(json.get("uid").getAsString()));
10588    if (json.has("_uid"))
10589      parseElementProperties(getJObject(json, "_uid"), res.getUidElement());
10590    if (json.has("accession"))
10591      res.setAccession(parseIdentifier(getJObject(json, "accession")));
10592    if (json.has("identifier")) {
10593      JsonArray array = json.getAsJsonArray("identifier");
10594      for (int i = 0; i < array.size(); i++) {
10595        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10596      }
10597    };
10598    if (json.has("availability"))
10599      res.setAvailabilityElement(parseEnumeration(json.get("availability").getAsString(), ImagingStudy.InstanceAvailability.NULL, new ImagingStudy.InstanceAvailabilityEnumFactory()));
10600    if (json.has("_availability"))
10601      parseElementProperties(getJObject(json, "_availability"), res.getAvailabilityElement());
10602    if (json.has("modalityList")) {
10603      JsonArray array = json.getAsJsonArray("modalityList");
10604      for (int i = 0; i < array.size(); i++) {
10605        res.getModalityList().add(parseCoding(array.get(i).getAsJsonObject()));
10606      }
10607    };
10608    if (json.has("patient"))
10609      res.setPatient(parseReference(getJObject(json, "patient")));
10610    if (json.has("context"))
10611      res.setContext(parseReference(getJObject(json, "context")));
10612    if (json.has("started"))
10613      res.setStartedElement(parseDateTime(json.get("started").getAsString()));
10614    if (json.has("_started"))
10615      parseElementProperties(getJObject(json, "_started"), res.getStartedElement());
10616    if (json.has("basedOn")) {
10617      JsonArray array = json.getAsJsonArray("basedOn");
10618      for (int i = 0; i < array.size(); i++) {
10619        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
10620      }
10621    };
10622    if (json.has("referrer"))
10623      res.setReferrer(parseReference(getJObject(json, "referrer")));
10624    if (json.has("interpreter")) {
10625      JsonArray array = json.getAsJsonArray("interpreter");
10626      for (int i = 0; i < array.size(); i++) {
10627        res.getInterpreter().add(parseReference(array.get(i).getAsJsonObject()));
10628      }
10629    };
10630    if (json.has("endpoint")) {
10631      JsonArray array = json.getAsJsonArray("endpoint");
10632      for (int i = 0; i < array.size(); i++) {
10633        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
10634      }
10635    };
10636    if (json.has("numberOfSeries"))
10637      res.setNumberOfSeriesElement(parseUnsignedInt(json.get("numberOfSeries").getAsString()));
10638    if (json.has("_numberOfSeries"))
10639      parseElementProperties(getJObject(json, "_numberOfSeries"), res.getNumberOfSeriesElement());
10640    if (json.has("numberOfInstances"))
10641      res.setNumberOfInstancesElement(parseUnsignedInt(json.get("numberOfInstances").getAsString()));
10642    if (json.has("_numberOfInstances"))
10643      parseElementProperties(getJObject(json, "_numberOfInstances"), res.getNumberOfInstancesElement());
10644    if (json.has("procedureReference")) {
10645      JsonArray array = json.getAsJsonArray("procedureReference");
10646      for (int i = 0; i < array.size(); i++) {
10647        res.getProcedureReference().add(parseReference(array.get(i).getAsJsonObject()));
10648      }
10649    };
10650    if (json.has("procedureCode")) {
10651      JsonArray array = json.getAsJsonArray("procedureCode");
10652      for (int i = 0; i < array.size(); i++) {
10653        res.getProcedureCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10654      }
10655    };
10656    if (json.has("reason"))
10657      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
10658    if (json.has("description"))
10659      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10660    if (json.has("_description"))
10661      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
10662    if (json.has("series")) {
10663      JsonArray array = json.getAsJsonArray("series");
10664      for (int i = 0; i < array.size(); i++) {
10665        res.getSeries().add(parseImagingStudyImagingStudySeriesComponent(array.get(i).getAsJsonObject(), res));
10666      }
10667    };
10668  }
10669
10670  protected ImagingStudy.ImagingStudySeriesComponent parseImagingStudyImagingStudySeriesComponent(JsonObject json, ImagingStudy owner) throws IOException, FHIRFormatError {
10671    ImagingStudy.ImagingStudySeriesComponent res = new ImagingStudy.ImagingStudySeriesComponent();
10672    parseImagingStudyImagingStudySeriesComponentProperties(json, owner, res);
10673    return res;
10674  }
10675
10676  protected void parseImagingStudyImagingStudySeriesComponentProperties(JsonObject json, ImagingStudy owner, ImagingStudy.ImagingStudySeriesComponent res) throws IOException, FHIRFormatError {
10677    parseBackboneProperties(json, res);
10678    if (json.has("uid"))
10679      res.setUidElement(parseOid(json.get("uid").getAsString()));
10680    if (json.has("_uid"))
10681      parseElementProperties(getJObject(json, "_uid"), res.getUidElement());
10682    if (json.has("number"))
10683      res.setNumberElement(parseUnsignedInt(json.get("number").getAsString()));
10684    if (json.has("_number"))
10685      parseElementProperties(getJObject(json, "_number"), res.getNumberElement());
10686    if (json.has("modality"))
10687      res.setModality(parseCoding(getJObject(json, "modality")));
10688    if (json.has("description"))
10689      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10690    if (json.has("_description"))
10691      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
10692    if (json.has("numberOfInstances"))
10693      res.setNumberOfInstancesElement(parseUnsignedInt(json.get("numberOfInstances").getAsString()));
10694    if (json.has("_numberOfInstances"))
10695      parseElementProperties(getJObject(json, "_numberOfInstances"), res.getNumberOfInstancesElement());
10696    if (json.has("availability"))
10697      res.setAvailabilityElement(parseEnumeration(json.get("availability").getAsString(), ImagingStudy.InstanceAvailability.NULL, new ImagingStudy.InstanceAvailabilityEnumFactory()));
10698    if (json.has("_availability"))
10699      parseElementProperties(getJObject(json, "_availability"), res.getAvailabilityElement());
10700    if (json.has("endpoint")) {
10701      JsonArray array = json.getAsJsonArray("endpoint");
10702      for (int i = 0; i < array.size(); i++) {
10703        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
10704      }
10705    };
10706    if (json.has("bodySite"))
10707      res.setBodySite(parseCoding(getJObject(json, "bodySite")));
10708    if (json.has("laterality"))
10709      res.setLaterality(parseCoding(getJObject(json, "laterality")));
10710    if (json.has("started"))
10711      res.setStartedElement(parseDateTime(json.get("started").getAsString()));
10712    if (json.has("_started"))
10713      parseElementProperties(getJObject(json, "_started"), res.getStartedElement());
10714    if (json.has("performer")) {
10715      JsonArray array = json.getAsJsonArray("performer");
10716      for (int i = 0; i < array.size(); i++) {
10717        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
10718      }
10719    };
10720    if (json.has("instance")) {
10721      JsonArray array = json.getAsJsonArray("instance");
10722      for (int i = 0; i < array.size(); i++) {
10723        res.getInstance().add(parseImagingStudyImagingStudySeriesInstanceComponent(array.get(i).getAsJsonObject(), owner));
10724      }
10725    };
10726  }
10727
10728  protected ImagingStudy.ImagingStudySeriesInstanceComponent parseImagingStudyImagingStudySeriesInstanceComponent(JsonObject json, ImagingStudy owner) throws IOException, FHIRFormatError {
10729    ImagingStudy.ImagingStudySeriesInstanceComponent res = new ImagingStudy.ImagingStudySeriesInstanceComponent();
10730    parseImagingStudyImagingStudySeriesInstanceComponentProperties(json, owner, res);
10731    return res;
10732  }
10733
10734  protected void parseImagingStudyImagingStudySeriesInstanceComponentProperties(JsonObject json, ImagingStudy owner, ImagingStudy.ImagingStudySeriesInstanceComponent res) throws IOException, FHIRFormatError {
10735    parseBackboneProperties(json, res);
10736    if (json.has("uid"))
10737      res.setUidElement(parseOid(json.get("uid").getAsString()));
10738    if (json.has("_uid"))
10739      parseElementProperties(getJObject(json, "_uid"), res.getUidElement());
10740    if (json.has("number"))
10741      res.setNumberElement(parseUnsignedInt(json.get("number").getAsString()));
10742    if (json.has("_number"))
10743      parseElementProperties(getJObject(json, "_number"), res.getNumberElement());
10744    if (json.has("sopClass"))
10745      res.setSopClassElement(parseOid(json.get("sopClass").getAsString()));
10746    if (json.has("_sopClass"))
10747      parseElementProperties(getJObject(json, "_sopClass"), res.getSopClassElement());
10748    if (json.has("title"))
10749      res.setTitleElement(parseString(json.get("title").getAsString()));
10750    if (json.has("_title"))
10751      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
10752  }
10753
10754  protected Immunization parseImmunization(JsonObject json) throws IOException, FHIRFormatError {
10755    Immunization res = new Immunization();
10756    parseImmunizationProperties(json, res);
10757    return res;
10758  }
10759
10760  protected void parseImmunizationProperties(JsonObject json, Immunization res) throws IOException, FHIRFormatError {
10761    parseDomainResourceProperties(json, res);
10762    if (json.has("identifier")) {
10763      JsonArray array = json.getAsJsonArray("identifier");
10764      for (int i = 0; i < array.size(); i++) {
10765        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10766      }
10767    };
10768    if (json.has("status"))
10769      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Immunization.ImmunizationStatus.NULL, new Immunization.ImmunizationStatusEnumFactory()));
10770    if (json.has("_status"))
10771      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
10772    if (json.has("notGiven"))
10773      res.setNotGivenElement(parseBoolean(json.get("notGiven").getAsBoolean()));
10774    if (json.has("_notGiven"))
10775      parseElementProperties(getJObject(json, "_notGiven"), res.getNotGivenElement());
10776    if (json.has("vaccineCode"))
10777      res.setVaccineCode(parseCodeableConcept(getJObject(json, "vaccineCode")));
10778    if (json.has("patient"))
10779      res.setPatient(parseReference(getJObject(json, "patient")));
10780    if (json.has("encounter"))
10781      res.setEncounter(parseReference(getJObject(json, "encounter")));
10782    if (json.has("date"))
10783      res.setDateElement(parseDateTime(json.get("date").getAsString()));
10784    if (json.has("_date"))
10785      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
10786    if (json.has("primarySource"))
10787      res.setPrimarySourceElement(parseBoolean(json.get("primarySource").getAsBoolean()));
10788    if (json.has("_primarySource"))
10789      parseElementProperties(getJObject(json, "_primarySource"), res.getPrimarySourceElement());
10790    if (json.has("reportOrigin"))
10791      res.setReportOrigin(parseCodeableConcept(getJObject(json, "reportOrigin")));
10792    if (json.has("location"))
10793      res.setLocation(parseReference(getJObject(json, "location")));
10794    if (json.has("manufacturer"))
10795      res.setManufacturer(parseReference(getJObject(json, "manufacturer")));
10796    if (json.has("lotNumber"))
10797      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
10798    if (json.has("_lotNumber"))
10799      parseElementProperties(getJObject(json, "_lotNumber"), res.getLotNumberElement());
10800    if (json.has("expirationDate"))
10801      res.setExpirationDateElement(parseDate(json.get("expirationDate").getAsString()));
10802    if (json.has("_expirationDate"))
10803      parseElementProperties(getJObject(json, "_expirationDate"), res.getExpirationDateElement());
10804    if (json.has("site"))
10805      res.setSite(parseCodeableConcept(getJObject(json, "site")));
10806    if (json.has("route"))
10807      res.setRoute(parseCodeableConcept(getJObject(json, "route")));
10808    if (json.has("doseQuantity"))
10809      res.setDoseQuantity(parseSimpleQuantity(getJObject(json, "doseQuantity")));
10810    if (json.has("practitioner")) {
10811      JsonArray array = json.getAsJsonArray("practitioner");
10812      for (int i = 0; i < array.size(); i++) {
10813        res.getPractitioner().add(parseImmunizationImmunizationPractitionerComponent(array.get(i).getAsJsonObject(), res));
10814      }
10815    };
10816    if (json.has("note")) {
10817      JsonArray array = json.getAsJsonArray("note");
10818      for (int i = 0; i < array.size(); i++) {
10819        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
10820      }
10821    };
10822    if (json.has("explanation"))
10823      res.setExplanation(parseImmunizationImmunizationExplanationComponent(getJObject(json, "explanation"), res));
10824    if (json.has("reaction")) {
10825      JsonArray array = json.getAsJsonArray("reaction");
10826      for (int i = 0; i < array.size(); i++) {
10827        res.getReaction().add(parseImmunizationImmunizationReactionComponent(array.get(i).getAsJsonObject(), res));
10828      }
10829    };
10830    if (json.has("vaccinationProtocol")) {
10831      JsonArray array = json.getAsJsonArray("vaccinationProtocol");
10832      for (int i = 0; i < array.size(); i++) {
10833        res.getVaccinationProtocol().add(parseImmunizationImmunizationVaccinationProtocolComponent(array.get(i).getAsJsonObject(), res));
10834      }
10835    };
10836  }
10837
10838  protected Immunization.ImmunizationPractitionerComponent parseImmunizationImmunizationPractitionerComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
10839    Immunization.ImmunizationPractitionerComponent res = new Immunization.ImmunizationPractitionerComponent();
10840    parseImmunizationImmunizationPractitionerComponentProperties(json, owner, res);
10841    return res;
10842  }
10843
10844  protected void parseImmunizationImmunizationPractitionerComponentProperties(JsonObject json, Immunization owner, Immunization.ImmunizationPractitionerComponent res) throws IOException, FHIRFormatError {
10845    parseBackboneProperties(json, res);
10846    if (json.has("role"))
10847      res.setRole(parseCodeableConcept(getJObject(json, "role")));
10848    if (json.has("actor"))
10849      res.setActor(parseReference(getJObject(json, "actor")));
10850  }
10851
10852  protected Immunization.ImmunizationExplanationComponent parseImmunizationImmunizationExplanationComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
10853    Immunization.ImmunizationExplanationComponent res = new Immunization.ImmunizationExplanationComponent();
10854    parseImmunizationImmunizationExplanationComponentProperties(json, owner, res);
10855    return res;
10856  }
10857
10858  protected void parseImmunizationImmunizationExplanationComponentProperties(JsonObject json, Immunization owner, Immunization.ImmunizationExplanationComponent res) throws IOException, FHIRFormatError {
10859    parseBackboneProperties(json, res);
10860    if (json.has("reason")) {
10861      JsonArray array = json.getAsJsonArray("reason");
10862      for (int i = 0; i < array.size(); i++) {
10863        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10864      }
10865    };
10866    if (json.has("reasonNotGiven")) {
10867      JsonArray array = json.getAsJsonArray("reasonNotGiven");
10868      for (int i = 0; i < array.size(); i++) {
10869        res.getReasonNotGiven().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10870      }
10871    };
10872  }
10873
10874  protected Immunization.ImmunizationReactionComponent parseImmunizationImmunizationReactionComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
10875    Immunization.ImmunizationReactionComponent res = new Immunization.ImmunizationReactionComponent();
10876    parseImmunizationImmunizationReactionComponentProperties(json, owner, res);
10877    return res;
10878  }
10879
10880  protected void parseImmunizationImmunizationReactionComponentProperties(JsonObject json, Immunization owner, Immunization.ImmunizationReactionComponent res) throws IOException, FHIRFormatError {
10881    parseBackboneProperties(json, res);
10882    if (json.has("date"))
10883      res.setDateElement(parseDateTime(json.get("date").getAsString()));
10884    if (json.has("_date"))
10885      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
10886    if (json.has("detail"))
10887      res.setDetail(parseReference(getJObject(json, "detail")));
10888    if (json.has("reported"))
10889      res.setReportedElement(parseBoolean(json.get("reported").getAsBoolean()));
10890    if (json.has("_reported"))
10891      parseElementProperties(getJObject(json, "_reported"), res.getReportedElement());
10892  }
10893
10894  protected Immunization.ImmunizationVaccinationProtocolComponent parseImmunizationImmunizationVaccinationProtocolComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
10895    Immunization.ImmunizationVaccinationProtocolComponent res = new Immunization.ImmunizationVaccinationProtocolComponent();
10896    parseImmunizationImmunizationVaccinationProtocolComponentProperties(json, owner, res);
10897    return res;
10898  }
10899
10900  protected void parseImmunizationImmunizationVaccinationProtocolComponentProperties(JsonObject json, Immunization owner, Immunization.ImmunizationVaccinationProtocolComponent res) throws IOException, FHIRFormatError {
10901    parseBackboneProperties(json, res);
10902    if (json.has("doseSequence"))
10903      res.setDoseSequenceElement(parsePositiveInt(json.get("doseSequence").getAsString()));
10904    if (json.has("_doseSequence"))
10905      parseElementProperties(getJObject(json, "_doseSequence"), res.getDoseSequenceElement());
10906    if (json.has("description"))
10907      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10908    if (json.has("_description"))
10909      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
10910    if (json.has("authority"))
10911      res.setAuthority(parseReference(getJObject(json, "authority")));
10912    if (json.has("series"))
10913      res.setSeriesElement(parseString(json.get("series").getAsString()));
10914    if (json.has("_series"))
10915      parseElementProperties(getJObject(json, "_series"), res.getSeriesElement());
10916    if (json.has("seriesDoses"))
10917      res.setSeriesDosesElement(parsePositiveInt(json.get("seriesDoses").getAsString()));
10918    if (json.has("_seriesDoses"))
10919      parseElementProperties(getJObject(json, "_seriesDoses"), res.getSeriesDosesElement());
10920    if (json.has("targetDisease")) {
10921      JsonArray array = json.getAsJsonArray("targetDisease");
10922      for (int i = 0; i < array.size(); i++) {
10923        res.getTargetDisease().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10924      }
10925    };
10926    if (json.has("doseStatus"))
10927      res.setDoseStatus(parseCodeableConcept(getJObject(json, "doseStatus")));
10928    if (json.has("doseStatusReason"))
10929      res.setDoseStatusReason(parseCodeableConcept(getJObject(json, "doseStatusReason")));
10930  }
10931
10932  protected ImmunizationRecommendation parseImmunizationRecommendation(JsonObject json) throws IOException, FHIRFormatError {
10933    ImmunizationRecommendation res = new ImmunizationRecommendation();
10934    parseImmunizationRecommendationProperties(json, res);
10935    return res;
10936  }
10937
10938  protected void parseImmunizationRecommendationProperties(JsonObject json, ImmunizationRecommendation res) throws IOException, FHIRFormatError {
10939    parseDomainResourceProperties(json, res);
10940    if (json.has("identifier")) {
10941      JsonArray array = json.getAsJsonArray("identifier");
10942      for (int i = 0; i < array.size(); i++) {
10943        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10944      }
10945    };
10946    if (json.has("patient"))
10947      res.setPatient(parseReference(getJObject(json, "patient")));
10948    if (json.has("recommendation")) {
10949      JsonArray array = json.getAsJsonArray("recommendation");
10950      for (int i = 0; i < array.size(); i++) {
10951        res.getRecommendation().add(parseImmunizationRecommendationImmunizationRecommendationRecommendationComponent(array.get(i).getAsJsonObject(), res));
10952      }
10953    };
10954  }
10955
10956  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent parseImmunizationRecommendationImmunizationRecommendationRecommendationComponent(JsonObject json, ImmunizationRecommendation owner) throws IOException, FHIRFormatError {
10957    ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent();
10958    parseImmunizationRecommendationImmunizationRecommendationRecommendationComponentProperties(json, owner, res);
10959    return res;
10960  }
10961
10962  protected void parseImmunizationRecommendationImmunizationRecommendationRecommendationComponentProperties(JsonObject json, ImmunizationRecommendation owner, ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent res) throws IOException, FHIRFormatError {
10963    parseBackboneProperties(json, res);
10964    if (json.has("date"))
10965      res.setDateElement(parseDateTime(json.get("date").getAsString()));
10966    if (json.has("_date"))
10967      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
10968    if (json.has("vaccineCode"))
10969      res.setVaccineCode(parseCodeableConcept(getJObject(json, "vaccineCode")));
10970    if (json.has("targetDisease"))
10971      res.setTargetDisease(parseCodeableConcept(getJObject(json, "targetDisease")));
10972    if (json.has("doseNumber"))
10973      res.setDoseNumberElement(parsePositiveInt(json.get("doseNumber").getAsString()));
10974    if (json.has("_doseNumber"))
10975      parseElementProperties(getJObject(json, "_doseNumber"), res.getDoseNumberElement());
10976    if (json.has("forecastStatus"))
10977      res.setForecastStatus(parseCodeableConcept(getJObject(json, "forecastStatus")));
10978    if (json.has("dateCriterion")) {
10979      JsonArray array = json.getAsJsonArray("dateCriterion");
10980      for (int i = 0; i < array.size(); i++) {
10981        res.getDateCriterion().add(parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(array.get(i).getAsJsonObject(), owner));
10982      }
10983    };
10984    if (json.has("protocol"))
10985      res.setProtocol(parseImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponent(getJObject(json, "protocol"), owner));
10986    if (json.has("supportingImmunization")) {
10987      JsonArray array = json.getAsJsonArray("supportingImmunization");
10988      for (int i = 0; i < array.size(); i++) {
10989        res.getSupportingImmunization().add(parseReference(array.get(i).getAsJsonObject()));
10990      }
10991    };
10992    if (json.has("supportingPatientInformation")) {
10993      JsonArray array = json.getAsJsonArray("supportingPatientInformation");
10994      for (int i = 0; i < array.size(); i++) {
10995        res.getSupportingPatientInformation().add(parseReference(array.get(i).getAsJsonObject()));
10996      }
10997    };
10998  }
10999
11000  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(JsonObject json, ImmunizationRecommendation owner) throws IOException, FHIRFormatError {
11001    ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent();
11002    parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentProperties(json, owner, res);
11003    return res;
11004  }
11005
11006  protected void parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentProperties(JsonObject json, ImmunizationRecommendation owner, ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent res) throws IOException, FHIRFormatError {
11007    parseBackboneProperties(json, res);
11008    if (json.has("code"))
11009      res.setCode(parseCodeableConcept(getJObject(json, "code")));
11010    if (json.has("value"))
11011      res.setValueElement(parseDateTime(json.get("value").getAsString()));
11012    if (json.has("_value"))
11013      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
11014  }
11015
11016  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent parseImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponent(JsonObject json, ImmunizationRecommendation owner) throws IOException, FHIRFormatError {
11017    ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent();
11018    parseImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponentProperties(json, owner, res);
11019    return res;
11020  }
11021
11022  protected void parseImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponentProperties(JsonObject json, ImmunizationRecommendation owner, ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent res) throws IOException, FHIRFormatError {
11023    parseBackboneProperties(json, res);
11024    if (json.has("doseSequence"))
11025      res.setDoseSequenceElement(parsePositiveInt(json.get("doseSequence").getAsString()));
11026    if (json.has("_doseSequence"))
11027      parseElementProperties(getJObject(json, "_doseSequence"), res.getDoseSequenceElement());
11028    if (json.has("description"))
11029      res.setDescriptionElement(parseString(json.get("description").getAsString()));
11030    if (json.has("_description"))
11031      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
11032    if (json.has("authority"))
11033      res.setAuthority(parseReference(getJObject(json, "authority")));
11034    if (json.has("series"))
11035      res.setSeriesElement(parseString(json.get("series").getAsString()));
11036    if (json.has("_series"))
11037      parseElementProperties(getJObject(json, "_series"), res.getSeriesElement());
11038  }
11039
11040  protected ImplementationGuide parseImplementationGuide(JsonObject json) throws IOException, FHIRFormatError {
11041    ImplementationGuide res = new ImplementationGuide();
11042    parseImplementationGuideProperties(json, res);
11043    return res;
11044  }
11045
11046  protected void parseImplementationGuideProperties(JsonObject json, ImplementationGuide res) throws IOException, FHIRFormatError {
11047    parseDomainResourceProperties(json, res);
11048    if (json.has("url"))
11049      res.setUrlElement(parseUri(json.get("url").getAsString()));
11050    if (json.has("_url"))
11051      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
11052    if (json.has("version"))
11053      res.setVersionElement(parseString(json.get("version").getAsString()));
11054    if (json.has("_version"))
11055      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
11056    if (json.has("name"))
11057      res.setNameElement(parseString(json.get("name").getAsString()));
11058    if (json.has("_name"))
11059      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
11060    if (json.has("status"))
11061      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
11062    if (json.has("_status"))
11063      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11064    if (json.has("experimental"))
11065      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
11066    if (json.has("_experimental"))
11067      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
11068    if (json.has("date"))
11069      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11070    if (json.has("_date"))
11071      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
11072    if (json.has("publisher"))
11073      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
11074    if (json.has("_publisher"))
11075      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
11076    if (json.has("contact")) {
11077      JsonArray array = json.getAsJsonArray("contact");
11078      for (int i = 0; i < array.size(); i++) {
11079        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
11080      }
11081    };
11082    if (json.has("description"))
11083      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11084    if (json.has("_description"))
11085      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
11086    if (json.has("useContext")) {
11087      JsonArray array = json.getAsJsonArray("useContext");
11088      for (int i = 0; i < array.size(); i++) {
11089        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
11090      }
11091    };
11092    if (json.has("jurisdiction")) {
11093      JsonArray array = json.getAsJsonArray("jurisdiction");
11094      for (int i = 0; i < array.size(); i++) {
11095        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11096      }
11097    };
11098    if (json.has("copyright"))
11099      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
11100    if (json.has("_copyright"))
11101      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
11102    if (json.has("fhirVersion"))
11103      res.setFhirVersionElement(parseId(json.get("fhirVersion").getAsString()));
11104    if (json.has("_fhirVersion"))
11105      parseElementProperties(getJObject(json, "_fhirVersion"), res.getFhirVersionElement());
11106    if (json.has("dependency")) {
11107      JsonArray array = json.getAsJsonArray("dependency");
11108      for (int i = 0; i < array.size(); i++) {
11109        res.getDependency().add(parseImplementationGuideImplementationGuideDependencyComponent(array.get(i).getAsJsonObject(), res));
11110      }
11111    };
11112    if (json.has("package")) {
11113      JsonArray array = json.getAsJsonArray("package");
11114      for (int i = 0; i < array.size(); i++) {
11115        res.getPackage().add(parseImplementationGuideImplementationGuidePackageComponent(array.get(i).getAsJsonObject(), res));
11116      }
11117    };
11118    if (json.has("global")) {
11119      JsonArray array = json.getAsJsonArray("global");
11120      for (int i = 0; i < array.size(); i++) {
11121        res.getGlobal().add(parseImplementationGuideImplementationGuideGlobalComponent(array.get(i).getAsJsonObject(), res));
11122      }
11123    };
11124    if (json.has("binary")) {
11125      JsonArray array = json.getAsJsonArray("binary");
11126      for (int i = 0; i < array.size(); i++) {
11127        if (array.get(i).isJsonNull()) {
11128          res.getBinary().add(new UriType());
11129        } else {
11130          res.getBinary().add(parseUri(array.get(i).getAsString()));
11131        }
11132      }
11133    };
11134    if (json.has("_binary")) {
11135      JsonArray array = json.getAsJsonArray("_binary");
11136      for (int i = 0; i < array.size(); i++) {
11137        if (i == res.getBinary().size())
11138          res.getBinary().add(parseUri(null));
11139        if (array.get(i) instanceof JsonObject) 
11140          parseElementProperties(array.get(i).getAsJsonObject(), res.getBinary().get(i));
11141      }
11142    };
11143    if (json.has("page"))
11144      res.setPage(parseImplementationGuideImplementationGuidePageComponent(getJObject(json, "page"), res));
11145  }
11146
11147  protected ImplementationGuide.ImplementationGuideDependencyComponent parseImplementationGuideImplementationGuideDependencyComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
11148    ImplementationGuide.ImplementationGuideDependencyComponent res = new ImplementationGuide.ImplementationGuideDependencyComponent();
11149    parseImplementationGuideImplementationGuideDependencyComponentProperties(json, owner, res);
11150    return res;
11151  }
11152
11153  protected void parseImplementationGuideImplementationGuideDependencyComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDependencyComponent res) throws IOException, FHIRFormatError {
11154    parseBackboneProperties(json, res);
11155    if (json.has("type"))
11156      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ImplementationGuide.GuideDependencyType.NULL, new ImplementationGuide.GuideDependencyTypeEnumFactory()));
11157    if (json.has("_type"))
11158      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
11159    if (json.has("uri"))
11160      res.setUriElement(parseUri(json.get("uri").getAsString()));
11161    if (json.has("_uri"))
11162      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
11163  }
11164
11165  protected ImplementationGuide.ImplementationGuidePackageComponent parseImplementationGuideImplementationGuidePackageComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
11166    ImplementationGuide.ImplementationGuidePackageComponent res = new ImplementationGuide.ImplementationGuidePackageComponent();
11167    parseImplementationGuideImplementationGuidePackageComponentProperties(json, owner, res);
11168    return res;
11169  }
11170
11171  protected void parseImplementationGuideImplementationGuidePackageComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuidePackageComponent res) throws IOException, FHIRFormatError {
11172    parseBackboneProperties(json, res);
11173    if (json.has("name"))
11174      res.setNameElement(parseString(json.get("name").getAsString()));
11175    if (json.has("_name"))
11176      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
11177    if (json.has("description"))
11178      res.setDescriptionElement(parseString(json.get("description").getAsString()));
11179    if (json.has("_description"))
11180      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
11181    if (json.has("resource")) {
11182      JsonArray array = json.getAsJsonArray("resource");
11183      for (int i = 0; i < array.size(); i++) {
11184        res.getResource().add(parseImplementationGuideImplementationGuidePackageResourceComponent(array.get(i).getAsJsonObject(), owner));
11185      }
11186    };
11187  }
11188
11189  protected ImplementationGuide.ImplementationGuidePackageResourceComponent parseImplementationGuideImplementationGuidePackageResourceComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
11190    ImplementationGuide.ImplementationGuidePackageResourceComponent res = new ImplementationGuide.ImplementationGuidePackageResourceComponent();
11191    parseImplementationGuideImplementationGuidePackageResourceComponentProperties(json, owner, res);
11192    return res;
11193  }
11194
11195  protected void parseImplementationGuideImplementationGuidePackageResourceComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuidePackageResourceComponent res) throws IOException, FHIRFormatError {
11196    parseBackboneProperties(json, res);
11197    if (json.has("example"))
11198      res.setExampleElement(parseBoolean(json.get("example").getAsBoolean()));
11199    if (json.has("_example"))
11200      parseElementProperties(getJObject(json, "_example"), res.getExampleElement());
11201    if (json.has("name"))
11202      res.setNameElement(parseString(json.get("name").getAsString()));
11203    if (json.has("_name"))
11204      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
11205    if (json.has("description"))
11206      res.setDescriptionElement(parseString(json.get("description").getAsString()));
11207    if (json.has("_description"))
11208      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
11209    if (json.has("acronym"))
11210      res.setAcronymElement(parseString(json.get("acronym").getAsString()));
11211    if (json.has("_acronym"))
11212      parseElementProperties(getJObject(json, "_acronym"), res.getAcronymElement());
11213    Type source = parseType("source", json);
11214    if (source != null)
11215      res.setSource(source);
11216    if (json.has("exampleFor"))
11217      res.setExampleFor(parseReference(getJObject(json, "exampleFor")));
11218  }
11219
11220  protected ImplementationGuide.ImplementationGuideGlobalComponent parseImplementationGuideImplementationGuideGlobalComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
11221    ImplementationGuide.ImplementationGuideGlobalComponent res = new ImplementationGuide.ImplementationGuideGlobalComponent();
11222    parseImplementationGuideImplementationGuideGlobalComponentProperties(json, owner, res);
11223    return res;
11224  }
11225
11226  protected void parseImplementationGuideImplementationGuideGlobalComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideGlobalComponent res) throws IOException, FHIRFormatError {
11227    parseBackboneProperties(json, res);
11228    if (json.has("type"))
11229      res.setTypeElement(parseCode(json.get("type").getAsString()));
11230    if (json.has("_type"))
11231      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
11232    if (json.has("profile"))
11233      res.setProfile(parseReference(getJObject(json, "profile")));
11234  }
11235
11236  protected ImplementationGuide.ImplementationGuidePageComponent parseImplementationGuideImplementationGuidePageComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
11237    ImplementationGuide.ImplementationGuidePageComponent res = new ImplementationGuide.ImplementationGuidePageComponent();
11238    parseImplementationGuideImplementationGuidePageComponentProperties(json, owner, res);
11239    return res;
11240  }
11241
11242  protected void parseImplementationGuideImplementationGuidePageComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuidePageComponent res) throws IOException, FHIRFormatError {
11243    parseBackboneProperties(json, res);
11244    if (json.has("source"))
11245      res.setSourceElement(parseUri(json.get("source").getAsString()));
11246    if (json.has("_source"))
11247      parseElementProperties(getJObject(json, "_source"), res.getSourceElement());
11248    if (json.has("title"))
11249      res.setTitleElement(parseString(json.get("title").getAsString()));
11250    if (json.has("_title"))
11251      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
11252    if (json.has("kind"))
11253      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), ImplementationGuide.GuidePageKind.NULL, new ImplementationGuide.GuidePageKindEnumFactory()));
11254    if (json.has("_kind"))
11255      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
11256    if (json.has("type")) {
11257      JsonArray array = json.getAsJsonArray("type");
11258      for (int i = 0; i < array.size(); i++) {
11259        if (array.get(i).isJsonNull()) {
11260          res.getType().add(new CodeType());
11261        } else {
11262          res.getType().add(parseCode(array.get(i).getAsString()));
11263        }
11264      }
11265    };
11266    if (json.has("_type")) {
11267      JsonArray array = json.getAsJsonArray("_type");
11268      for (int i = 0; i < array.size(); i++) {
11269        if (i == res.getType().size())
11270          res.getType().add(parseCode(null));
11271        if (array.get(i) instanceof JsonObject) 
11272          parseElementProperties(array.get(i).getAsJsonObject(), res.getType().get(i));
11273      }
11274    };
11275    if (json.has("package")) {
11276      JsonArray array = json.getAsJsonArray("package");
11277      for (int i = 0; i < array.size(); i++) {
11278        if (array.get(i).isJsonNull()) {
11279          res.getPackage().add(new StringType());
11280        } else {
11281          res.getPackage().add(parseString(array.get(i).getAsString()));
11282        }
11283      }
11284    };
11285    if (json.has("_package")) {
11286      JsonArray array = json.getAsJsonArray("_package");
11287      for (int i = 0; i < array.size(); i++) {
11288        if (i == res.getPackage().size())
11289          res.getPackage().add(parseString(null));
11290        if (array.get(i) instanceof JsonObject) 
11291          parseElementProperties(array.get(i).getAsJsonObject(), res.getPackage().get(i));
11292      }
11293    };
11294    if (json.has("format"))
11295      res.setFormatElement(parseCode(json.get("format").getAsString()));
11296    if (json.has("_format"))
11297      parseElementProperties(getJObject(json, "_format"), res.getFormatElement());
11298    if (json.has("page")) {
11299      JsonArray array = json.getAsJsonArray("page");
11300      for (int i = 0; i < array.size(); i++) {
11301        res.getPage().add(parseImplementationGuideImplementationGuidePageComponent(array.get(i).getAsJsonObject(), owner));
11302      }
11303    };
11304  }
11305
11306  protected Library parseLibrary(JsonObject json) throws IOException, FHIRFormatError {
11307    Library res = new Library();
11308    parseLibraryProperties(json, res);
11309    return res;
11310  }
11311
11312  protected void parseLibraryProperties(JsonObject json, Library res) throws IOException, FHIRFormatError {
11313    parseDomainResourceProperties(json, res);
11314    if (json.has("url"))
11315      res.setUrlElement(parseUri(json.get("url").getAsString()));
11316    if (json.has("_url"))
11317      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
11318    if (json.has("identifier")) {
11319      JsonArray array = json.getAsJsonArray("identifier");
11320      for (int i = 0; i < array.size(); i++) {
11321        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11322      }
11323    };
11324    if (json.has("version"))
11325      res.setVersionElement(parseString(json.get("version").getAsString()));
11326    if (json.has("_version"))
11327      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
11328    if (json.has("name"))
11329      res.setNameElement(parseString(json.get("name").getAsString()));
11330    if (json.has("_name"))
11331      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
11332    if (json.has("title"))
11333      res.setTitleElement(parseString(json.get("title").getAsString()));
11334    if (json.has("_title"))
11335      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
11336    if (json.has("status"))
11337      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
11338    if (json.has("_status"))
11339      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11340    if (json.has("experimental"))
11341      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
11342    if (json.has("_experimental"))
11343      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
11344    if (json.has("type"))
11345      res.setType(parseCodeableConcept(getJObject(json, "type")));
11346    if (json.has("date"))
11347      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11348    if (json.has("_date"))
11349      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
11350    if (json.has("publisher"))
11351      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
11352    if (json.has("_publisher"))
11353      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
11354    if (json.has("description"))
11355      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11356    if (json.has("_description"))
11357      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
11358    if (json.has("purpose"))
11359      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
11360    if (json.has("_purpose"))
11361      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
11362    if (json.has("usage"))
11363      res.setUsageElement(parseString(json.get("usage").getAsString()));
11364    if (json.has("_usage"))
11365      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
11366    if (json.has("approvalDate"))
11367      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
11368    if (json.has("_approvalDate"))
11369      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
11370    if (json.has("lastReviewDate"))
11371      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
11372    if (json.has("_lastReviewDate"))
11373      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
11374    if (json.has("effectivePeriod"))
11375      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
11376    if (json.has("useContext")) {
11377      JsonArray array = json.getAsJsonArray("useContext");
11378      for (int i = 0; i < array.size(); i++) {
11379        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
11380      }
11381    };
11382    if (json.has("jurisdiction")) {
11383      JsonArray array = json.getAsJsonArray("jurisdiction");
11384      for (int i = 0; i < array.size(); i++) {
11385        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11386      }
11387    };
11388    if (json.has("topic")) {
11389      JsonArray array = json.getAsJsonArray("topic");
11390      for (int i = 0; i < array.size(); i++) {
11391        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11392      }
11393    };
11394    if (json.has("contributor")) {
11395      JsonArray array = json.getAsJsonArray("contributor");
11396      for (int i = 0; i < array.size(); i++) {
11397        res.getContributor().add(parseContributor(array.get(i).getAsJsonObject()));
11398      }
11399    };
11400    if (json.has("contact")) {
11401      JsonArray array = json.getAsJsonArray("contact");
11402      for (int i = 0; i < array.size(); i++) {
11403        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
11404      }
11405    };
11406    if (json.has("copyright"))
11407      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
11408    if (json.has("_copyright"))
11409      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
11410    if (json.has("relatedArtifact")) {
11411      JsonArray array = json.getAsJsonArray("relatedArtifact");
11412      for (int i = 0; i < array.size(); i++) {
11413        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
11414      }
11415    };
11416    if (json.has("parameter")) {
11417      JsonArray array = json.getAsJsonArray("parameter");
11418      for (int i = 0; i < array.size(); i++) {
11419        res.getParameter().add(parseParameterDefinition(array.get(i).getAsJsonObject()));
11420      }
11421    };
11422    if (json.has("dataRequirement")) {
11423      JsonArray array = json.getAsJsonArray("dataRequirement");
11424      for (int i = 0; i < array.size(); i++) {
11425        res.getDataRequirement().add(parseDataRequirement(array.get(i).getAsJsonObject()));
11426      }
11427    };
11428    if (json.has("content")) {
11429      JsonArray array = json.getAsJsonArray("content");
11430      for (int i = 0; i < array.size(); i++) {
11431        res.getContent().add(parseAttachment(array.get(i).getAsJsonObject()));
11432      }
11433    };
11434  }
11435
11436  protected Linkage parseLinkage(JsonObject json) throws IOException, FHIRFormatError {
11437    Linkage res = new Linkage();
11438    parseLinkageProperties(json, res);
11439    return res;
11440  }
11441
11442  protected void parseLinkageProperties(JsonObject json, Linkage res) throws IOException, FHIRFormatError {
11443    parseDomainResourceProperties(json, res);
11444    if (json.has("active"))
11445      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
11446    if (json.has("_active"))
11447      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
11448    if (json.has("author"))
11449      res.setAuthor(parseReference(getJObject(json, "author")));
11450    if (json.has("item")) {
11451      JsonArray array = json.getAsJsonArray("item");
11452      for (int i = 0; i < array.size(); i++) {
11453        res.getItem().add(parseLinkageLinkageItemComponent(array.get(i).getAsJsonObject(), res));
11454      }
11455    };
11456  }
11457
11458  protected Linkage.LinkageItemComponent parseLinkageLinkageItemComponent(JsonObject json, Linkage owner) throws IOException, FHIRFormatError {
11459    Linkage.LinkageItemComponent res = new Linkage.LinkageItemComponent();
11460    parseLinkageLinkageItemComponentProperties(json, owner, res);
11461    return res;
11462  }
11463
11464  protected void parseLinkageLinkageItemComponentProperties(JsonObject json, Linkage owner, Linkage.LinkageItemComponent res) throws IOException, FHIRFormatError {
11465    parseBackboneProperties(json, res);
11466    if (json.has("type"))
11467      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Linkage.LinkageType.NULL, new Linkage.LinkageTypeEnumFactory()));
11468    if (json.has("_type"))
11469      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
11470    if (json.has("resource"))
11471      res.setResource(parseReference(getJObject(json, "resource")));
11472  }
11473
11474  protected ListResource parseListResource(JsonObject json) throws IOException, FHIRFormatError {
11475    ListResource res = new ListResource();
11476    parseListResourceProperties(json, res);
11477    return res;
11478  }
11479
11480  protected void parseListResourceProperties(JsonObject json, ListResource res) throws IOException, FHIRFormatError {
11481    parseDomainResourceProperties(json, res);
11482    if (json.has("identifier")) {
11483      JsonArray array = json.getAsJsonArray("identifier");
11484      for (int i = 0; i < array.size(); i++) {
11485        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11486      }
11487    };
11488    if (json.has("status"))
11489      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ListResource.ListStatus.NULL, new ListResource.ListStatusEnumFactory()));
11490    if (json.has("_status"))
11491      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11492    if (json.has("mode"))
11493      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), ListResource.ListMode.NULL, new ListResource.ListModeEnumFactory()));
11494    if (json.has("_mode"))
11495      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
11496    if (json.has("title"))
11497      res.setTitleElement(parseString(json.get("title").getAsString()));
11498    if (json.has("_title"))
11499      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
11500    if (json.has("code"))
11501      res.setCode(parseCodeableConcept(getJObject(json, "code")));
11502    if (json.has("subject"))
11503      res.setSubject(parseReference(getJObject(json, "subject")));
11504    if (json.has("encounter"))
11505      res.setEncounter(parseReference(getJObject(json, "encounter")));
11506    if (json.has("date"))
11507      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11508    if (json.has("_date"))
11509      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
11510    if (json.has("source"))
11511      res.setSource(parseReference(getJObject(json, "source")));
11512    if (json.has("orderedBy"))
11513      res.setOrderedBy(parseCodeableConcept(getJObject(json, "orderedBy")));
11514    if (json.has("note")) {
11515      JsonArray array = json.getAsJsonArray("note");
11516      for (int i = 0; i < array.size(); i++) {
11517        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
11518      }
11519    };
11520    if (json.has("entry")) {
11521      JsonArray array = json.getAsJsonArray("entry");
11522      for (int i = 0; i < array.size(); i++) {
11523        res.getEntry().add(parseListResourceListEntryComponent(array.get(i).getAsJsonObject(), res));
11524      }
11525    };
11526    if (json.has("emptyReason"))
11527      res.setEmptyReason(parseCodeableConcept(getJObject(json, "emptyReason")));
11528  }
11529
11530  protected ListResource.ListEntryComponent parseListResourceListEntryComponent(JsonObject json, ListResource owner) throws IOException, FHIRFormatError {
11531    ListResource.ListEntryComponent res = new ListResource.ListEntryComponent();
11532    parseListResourceListEntryComponentProperties(json, owner, res);
11533    return res;
11534  }
11535
11536  protected void parseListResourceListEntryComponentProperties(JsonObject json, ListResource owner, ListResource.ListEntryComponent res) throws IOException, FHIRFormatError {
11537    parseBackboneProperties(json, res);
11538    if (json.has("flag"))
11539      res.setFlag(parseCodeableConcept(getJObject(json, "flag")));
11540    if (json.has("deleted"))
11541      res.setDeletedElement(parseBoolean(json.get("deleted").getAsBoolean()));
11542    if (json.has("_deleted"))
11543      parseElementProperties(getJObject(json, "_deleted"), res.getDeletedElement());
11544    if (json.has("date"))
11545      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11546    if (json.has("_date"))
11547      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
11548    if (json.has("item"))
11549      res.setItem(parseReference(getJObject(json, "item")));
11550  }
11551
11552  protected Location parseLocation(JsonObject json) throws IOException, FHIRFormatError {
11553    Location res = new Location();
11554    parseLocationProperties(json, res);
11555    return res;
11556  }
11557
11558  protected void parseLocationProperties(JsonObject json, Location res) throws IOException, FHIRFormatError {
11559    parseDomainResourceProperties(json, res);
11560    if (json.has("identifier")) {
11561      JsonArray array = json.getAsJsonArray("identifier");
11562      for (int i = 0; i < array.size(); i++) {
11563        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11564      }
11565    };
11566    if (json.has("status"))
11567      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Location.LocationStatus.NULL, new Location.LocationStatusEnumFactory()));
11568    if (json.has("_status"))
11569      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11570    if (json.has("operationalStatus"))
11571      res.setOperationalStatus(parseCoding(getJObject(json, "operationalStatus")));
11572    if (json.has("name"))
11573      res.setNameElement(parseString(json.get("name").getAsString()));
11574    if (json.has("_name"))
11575      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
11576    if (json.has("alias")) {
11577      JsonArray array = json.getAsJsonArray("alias");
11578      for (int i = 0; i < array.size(); i++) {
11579        if (array.get(i).isJsonNull()) {
11580          res.getAlias().add(new StringType());
11581        } else {
11582          res.getAlias().add(parseString(array.get(i).getAsString()));
11583        }
11584      }
11585    };
11586    if (json.has("_alias")) {
11587      JsonArray array = json.getAsJsonArray("_alias");
11588      for (int i = 0; i < array.size(); i++) {
11589        if (i == res.getAlias().size())
11590          res.getAlias().add(parseString(null));
11591        if (array.get(i) instanceof JsonObject) 
11592          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
11593      }
11594    };
11595    if (json.has("description"))
11596      res.setDescriptionElement(parseString(json.get("description").getAsString()));
11597    if (json.has("_description"))
11598      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
11599    if (json.has("mode"))
11600      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Location.LocationMode.NULL, new Location.LocationModeEnumFactory()));
11601    if (json.has("_mode"))
11602      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
11603    if (json.has("type"))
11604      res.setType(parseCodeableConcept(getJObject(json, "type")));
11605    if (json.has("telecom")) {
11606      JsonArray array = json.getAsJsonArray("telecom");
11607      for (int i = 0; i < array.size(); i++) {
11608        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
11609      }
11610    };
11611    if (json.has("address"))
11612      res.setAddress(parseAddress(getJObject(json, "address")));
11613    if (json.has("physicalType"))
11614      res.setPhysicalType(parseCodeableConcept(getJObject(json, "physicalType")));
11615    if (json.has("position"))
11616      res.setPosition(parseLocationLocationPositionComponent(getJObject(json, "position"), res));
11617    if (json.has("managingOrganization"))
11618      res.setManagingOrganization(parseReference(getJObject(json, "managingOrganization")));
11619    if (json.has("partOf"))
11620      res.setPartOf(parseReference(getJObject(json, "partOf")));
11621    if (json.has("endpoint")) {
11622      JsonArray array = json.getAsJsonArray("endpoint");
11623      for (int i = 0; i < array.size(); i++) {
11624        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
11625      }
11626    };
11627  }
11628
11629  protected Location.LocationPositionComponent parseLocationLocationPositionComponent(JsonObject json, Location owner) throws IOException, FHIRFormatError {
11630    Location.LocationPositionComponent res = new Location.LocationPositionComponent();
11631    parseLocationLocationPositionComponentProperties(json, owner, res);
11632    return res;
11633  }
11634
11635  protected void parseLocationLocationPositionComponentProperties(JsonObject json, Location owner, Location.LocationPositionComponent res) throws IOException, FHIRFormatError {
11636    parseBackboneProperties(json, res);
11637    if (json.has("longitude"))
11638      res.setLongitudeElement(parseDecimal(json.get("longitude").getAsBigDecimal()));
11639    if (json.has("_longitude"))
11640      parseElementProperties(getJObject(json, "_longitude"), res.getLongitudeElement());
11641    if (json.has("latitude"))
11642      res.setLatitudeElement(parseDecimal(json.get("latitude").getAsBigDecimal()));
11643    if (json.has("_latitude"))
11644      parseElementProperties(getJObject(json, "_latitude"), res.getLatitudeElement());
11645    if (json.has("altitude"))
11646      res.setAltitudeElement(parseDecimal(json.get("altitude").getAsBigDecimal()));
11647    if (json.has("_altitude"))
11648      parseElementProperties(getJObject(json, "_altitude"), res.getAltitudeElement());
11649  }
11650
11651  protected Measure parseMeasure(JsonObject json) throws IOException, FHIRFormatError {
11652    Measure res = new Measure();
11653    parseMeasureProperties(json, res);
11654    return res;
11655  }
11656
11657  protected void parseMeasureProperties(JsonObject json, Measure res) throws IOException, FHIRFormatError {
11658    parseDomainResourceProperties(json, res);
11659    if (json.has("url"))
11660      res.setUrlElement(parseUri(json.get("url").getAsString()));
11661    if (json.has("_url"))
11662      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
11663    if (json.has("identifier")) {
11664      JsonArray array = json.getAsJsonArray("identifier");
11665      for (int i = 0; i < array.size(); i++) {
11666        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11667      }
11668    };
11669    if (json.has("version"))
11670      res.setVersionElement(parseString(json.get("version").getAsString()));
11671    if (json.has("_version"))
11672      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
11673    if (json.has("name"))
11674      res.setNameElement(parseString(json.get("name").getAsString()));
11675    if (json.has("_name"))
11676      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
11677    if (json.has("title"))
11678      res.setTitleElement(parseString(json.get("title").getAsString()));
11679    if (json.has("_title"))
11680      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
11681    if (json.has("status"))
11682      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
11683    if (json.has("_status"))
11684      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11685    if (json.has("experimental"))
11686      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
11687    if (json.has("_experimental"))
11688      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
11689    if (json.has("date"))
11690      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11691    if (json.has("_date"))
11692      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
11693    if (json.has("publisher"))
11694      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
11695    if (json.has("_publisher"))
11696      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
11697    if (json.has("description"))
11698      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11699    if (json.has("_description"))
11700      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
11701    if (json.has("purpose"))
11702      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
11703    if (json.has("_purpose"))
11704      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
11705    if (json.has("usage"))
11706      res.setUsageElement(parseString(json.get("usage").getAsString()));
11707    if (json.has("_usage"))
11708      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
11709    if (json.has("approvalDate"))
11710      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
11711    if (json.has("_approvalDate"))
11712      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
11713    if (json.has("lastReviewDate"))
11714      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
11715    if (json.has("_lastReviewDate"))
11716      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
11717    if (json.has("effectivePeriod"))
11718      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
11719    if (json.has("useContext")) {
11720      JsonArray array = json.getAsJsonArray("useContext");
11721      for (int i = 0; i < array.size(); i++) {
11722        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
11723      }
11724    };
11725    if (json.has("jurisdiction")) {
11726      JsonArray array = json.getAsJsonArray("jurisdiction");
11727      for (int i = 0; i < array.size(); i++) {
11728        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11729      }
11730    };
11731    if (json.has("topic")) {
11732      JsonArray array = json.getAsJsonArray("topic");
11733      for (int i = 0; i < array.size(); i++) {
11734        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11735      }
11736    };
11737    if (json.has("contributor")) {
11738      JsonArray array = json.getAsJsonArray("contributor");
11739      for (int i = 0; i < array.size(); i++) {
11740        res.getContributor().add(parseContributor(array.get(i).getAsJsonObject()));
11741      }
11742    };
11743    if (json.has("contact")) {
11744      JsonArray array = json.getAsJsonArray("contact");
11745      for (int i = 0; i < array.size(); i++) {
11746        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
11747      }
11748    };
11749    if (json.has("copyright"))
11750      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
11751    if (json.has("_copyright"))
11752      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
11753    if (json.has("relatedArtifact")) {
11754      JsonArray array = json.getAsJsonArray("relatedArtifact");
11755      for (int i = 0; i < array.size(); i++) {
11756        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
11757      }
11758    };
11759    if (json.has("library")) {
11760      JsonArray array = json.getAsJsonArray("library");
11761      for (int i = 0; i < array.size(); i++) {
11762        res.getLibrary().add(parseReference(array.get(i).getAsJsonObject()));
11763      }
11764    };
11765    if (json.has("disclaimer"))
11766      res.setDisclaimerElement(parseMarkdown(json.get("disclaimer").getAsString()));
11767    if (json.has("_disclaimer"))
11768      parseElementProperties(getJObject(json, "_disclaimer"), res.getDisclaimerElement());
11769    if (json.has("scoring"))
11770      res.setScoring(parseCodeableConcept(getJObject(json, "scoring")));
11771    if (json.has("compositeScoring"))
11772      res.setCompositeScoring(parseCodeableConcept(getJObject(json, "compositeScoring")));
11773    if (json.has("type")) {
11774      JsonArray array = json.getAsJsonArray("type");
11775      for (int i = 0; i < array.size(); i++) {
11776        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11777      }
11778    };
11779    if (json.has("riskAdjustment"))
11780      res.setRiskAdjustmentElement(parseString(json.get("riskAdjustment").getAsString()));
11781    if (json.has("_riskAdjustment"))
11782      parseElementProperties(getJObject(json, "_riskAdjustment"), res.getRiskAdjustmentElement());
11783    if (json.has("rateAggregation"))
11784      res.setRateAggregationElement(parseString(json.get("rateAggregation").getAsString()));
11785    if (json.has("_rateAggregation"))
11786      parseElementProperties(getJObject(json, "_rateAggregation"), res.getRateAggregationElement());
11787    if (json.has("rationale"))
11788      res.setRationaleElement(parseMarkdown(json.get("rationale").getAsString()));
11789    if (json.has("_rationale"))
11790      parseElementProperties(getJObject(json, "_rationale"), res.getRationaleElement());
11791    if (json.has("clinicalRecommendationStatement"))
11792      res.setClinicalRecommendationStatementElement(parseMarkdown(json.get("clinicalRecommendationStatement").getAsString()));
11793    if (json.has("_clinicalRecommendationStatement"))
11794      parseElementProperties(getJObject(json, "_clinicalRecommendationStatement"), res.getClinicalRecommendationStatementElement());
11795    if (json.has("improvementNotation"))
11796      res.setImprovementNotationElement(parseString(json.get("improvementNotation").getAsString()));
11797    if (json.has("_improvementNotation"))
11798      parseElementProperties(getJObject(json, "_improvementNotation"), res.getImprovementNotationElement());
11799    if (json.has("definition")) {
11800      JsonArray array = json.getAsJsonArray("definition");
11801      for (int i = 0; i < array.size(); i++) {
11802        if (array.get(i).isJsonNull()) {
11803          res.getDefinition().add(new MarkdownType());
11804        } else {
11805          res.getDefinition().add(parseMarkdown(array.get(i).getAsString()));
11806        }
11807      }
11808    };
11809    if (json.has("_definition")) {
11810      JsonArray array = json.getAsJsonArray("_definition");
11811      for (int i = 0; i < array.size(); i++) {
11812        if (i == res.getDefinition().size())
11813          res.getDefinition().add(parseMarkdown(null));
11814        if (array.get(i) instanceof JsonObject) 
11815          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinition().get(i));
11816      }
11817    };
11818    if (json.has("guidance"))
11819      res.setGuidanceElement(parseMarkdown(json.get("guidance").getAsString()));
11820    if (json.has("_guidance"))
11821      parseElementProperties(getJObject(json, "_guidance"), res.getGuidanceElement());
11822    if (json.has("set"))
11823      res.setSetElement(parseString(json.get("set").getAsString()));
11824    if (json.has("_set"))
11825      parseElementProperties(getJObject(json, "_set"), res.getSetElement());
11826    if (json.has("group")) {
11827      JsonArray array = json.getAsJsonArray("group");
11828      for (int i = 0; i < array.size(); i++) {
11829        res.getGroup().add(parseMeasureMeasureGroupComponent(array.get(i).getAsJsonObject(), res));
11830      }
11831    };
11832    if (json.has("supplementalData")) {
11833      JsonArray array = json.getAsJsonArray("supplementalData");
11834      for (int i = 0; i < array.size(); i++) {
11835        res.getSupplementalData().add(parseMeasureMeasureSupplementalDataComponent(array.get(i).getAsJsonObject(), res));
11836      }
11837    };
11838  }
11839
11840  protected Measure.MeasureGroupComponent parseMeasureMeasureGroupComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
11841    Measure.MeasureGroupComponent res = new Measure.MeasureGroupComponent();
11842    parseMeasureMeasureGroupComponentProperties(json, owner, res);
11843    return res;
11844  }
11845
11846  protected void parseMeasureMeasureGroupComponentProperties(JsonObject json, Measure owner, Measure.MeasureGroupComponent res) throws IOException, FHIRFormatError {
11847    parseBackboneProperties(json, res);
11848    if (json.has("identifier"))
11849      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
11850    if (json.has("name"))
11851      res.setNameElement(parseString(json.get("name").getAsString()));
11852    if (json.has("_name"))
11853      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
11854    if (json.has("description"))
11855      res.setDescriptionElement(parseString(json.get("description").getAsString()));
11856    if (json.has("_description"))
11857      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
11858    if (json.has("population")) {
11859      JsonArray array = json.getAsJsonArray("population");
11860      for (int i = 0; i < array.size(); i++) {
11861        res.getPopulation().add(parseMeasureMeasureGroupPopulationComponent(array.get(i).getAsJsonObject(), owner));
11862      }
11863    };
11864    if (json.has("stratifier")) {
11865      JsonArray array = json.getAsJsonArray("stratifier");
11866      for (int i = 0; i < array.size(); i++) {
11867        res.getStratifier().add(parseMeasureMeasureGroupStratifierComponent(array.get(i).getAsJsonObject(), owner));
11868      }
11869    };
11870  }
11871
11872  protected Measure.MeasureGroupPopulationComponent parseMeasureMeasureGroupPopulationComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
11873    Measure.MeasureGroupPopulationComponent res = new Measure.MeasureGroupPopulationComponent();
11874    parseMeasureMeasureGroupPopulationComponentProperties(json, owner, res);
11875    return res;
11876  }
11877
11878  protected void parseMeasureMeasureGroupPopulationComponentProperties(JsonObject json, Measure owner, Measure.MeasureGroupPopulationComponent res) throws IOException, FHIRFormatError {
11879    parseBackboneProperties(json, res);
11880    if (json.has("identifier"))
11881      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
11882    if (json.has("code"))
11883      res.setCode(parseCodeableConcept(getJObject(json, "code")));
11884    if (json.has("name"))
11885      res.setNameElement(parseString(json.get("name").getAsString()));
11886    if (json.has("_name"))
11887      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
11888    if (json.has("description"))
11889      res.setDescriptionElement(parseString(json.get("description").getAsString()));
11890    if (json.has("_description"))
11891      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
11892    if (json.has("criteria"))
11893      res.setCriteriaElement(parseString(json.get("criteria").getAsString()));
11894    if (json.has("_criteria"))
11895      parseElementProperties(getJObject(json, "_criteria"), res.getCriteriaElement());
11896  }
11897
11898  protected Measure.MeasureGroupStratifierComponent parseMeasureMeasureGroupStratifierComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
11899    Measure.MeasureGroupStratifierComponent res = new Measure.MeasureGroupStratifierComponent();
11900    parseMeasureMeasureGroupStratifierComponentProperties(json, owner, res);
11901    return res;
11902  }
11903
11904  protected void parseMeasureMeasureGroupStratifierComponentProperties(JsonObject json, Measure owner, Measure.MeasureGroupStratifierComponent res) throws IOException, FHIRFormatError {
11905    parseBackboneProperties(json, res);
11906    if (json.has("identifier"))
11907      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
11908    if (json.has("criteria"))
11909      res.setCriteriaElement(parseString(json.get("criteria").getAsString()));
11910    if (json.has("_criteria"))
11911      parseElementProperties(getJObject(json, "_criteria"), res.getCriteriaElement());
11912    if (json.has("path"))
11913      res.setPathElement(parseString(json.get("path").getAsString()));
11914    if (json.has("_path"))
11915      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
11916  }
11917
11918  protected Measure.MeasureSupplementalDataComponent parseMeasureMeasureSupplementalDataComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
11919    Measure.MeasureSupplementalDataComponent res = new Measure.MeasureSupplementalDataComponent();
11920    parseMeasureMeasureSupplementalDataComponentProperties(json, owner, res);
11921    return res;
11922  }
11923
11924  protected void parseMeasureMeasureSupplementalDataComponentProperties(JsonObject json, Measure owner, Measure.MeasureSupplementalDataComponent res) throws IOException, FHIRFormatError {
11925    parseBackboneProperties(json, res);
11926    if (json.has("identifier"))
11927      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
11928    if (json.has("usage")) {
11929      JsonArray array = json.getAsJsonArray("usage");
11930      for (int i = 0; i < array.size(); i++) {
11931        res.getUsage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11932      }
11933    };
11934    if (json.has("criteria"))
11935      res.setCriteriaElement(parseString(json.get("criteria").getAsString()));
11936    if (json.has("_criteria"))
11937      parseElementProperties(getJObject(json, "_criteria"), res.getCriteriaElement());
11938    if (json.has("path"))
11939      res.setPathElement(parseString(json.get("path").getAsString()));
11940    if (json.has("_path"))
11941      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
11942  }
11943
11944  protected MeasureReport parseMeasureReport(JsonObject json) throws IOException, FHIRFormatError {
11945    MeasureReport res = new MeasureReport();
11946    parseMeasureReportProperties(json, res);
11947    return res;
11948  }
11949
11950  protected void parseMeasureReportProperties(JsonObject json, MeasureReport res) throws IOException, FHIRFormatError {
11951    parseDomainResourceProperties(json, res);
11952    if (json.has("identifier"))
11953      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
11954    if (json.has("status"))
11955      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MeasureReport.MeasureReportStatus.NULL, new MeasureReport.MeasureReportStatusEnumFactory()));
11956    if (json.has("_status"))
11957      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
11958    if (json.has("type"))
11959      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MeasureReport.MeasureReportType.NULL, new MeasureReport.MeasureReportTypeEnumFactory()));
11960    if (json.has("_type"))
11961      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
11962    if (json.has("measure"))
11963      res.setMeasure(parseReference(getJObject(json, "measure")));
11964    if (json.has("patient"))
11965      res.setPatient(parseReference(getJObject(json, "patient")));
11966    if (json.has("date"))
11967      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11968    if (json.has("_date"))
11969      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
11970    if (json.has("reportingOrganization"))
11971      res.setReportingOrganization(parseReference(getJObject(json, "reportingOrganization")));
11972    if (json.has("period"))
11973      res.setPeriod(parsePeriod(getJObject(json, "period")));
11974    if (json.has("group")) {
11975      JsonArray array = json.getAsJsonArray("group");
11976      for (int i = 0; i < array.size(); i++) {
11977        res.getGroup().add(parseMeasureReportMeasureReportGroupComponent(array.get(i).getAsJsonObject(), res));
11978      }
11979    };
11980    if (json.has("evaluatedResources"))
11981      res.setEvaluatedResources(parseReference(getJObject(json, "evaluatedResources")));
11982  }
11983
11984  protected MeasureReport.MeasureReportGroupComponent parseMeasureReportMeasureReportGroupComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
11985    MeasureReport.MeasureReportGroupComponent res = new MeasureReport.MeasureReportGroupComponent();
11986    parseMeasureReportMeasureReportGroupComponentProperties(json, owner, res);
11987    return res;
11988  }
11989
11990  protected void parseMeasureReportMeasureReportGroupComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.MeasureReportGroupComponent res) throws IOException, FHIRFormatError {
11991    parseBackboneProperties(json, res);
11992    if (json.has("identifier"))
11993      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
11994    if (json.has("population")) {
11995      JsonArray array = json.getAsJsonArray("population");
11996      for (int i = 0; i < array.size(); i++) {
11997        res.getPopulation().add(parseMeasureReportMeasureReportGroupPopulationComponent(array.get(i).getAsJsonObject(), owner));
11998      }
11999    };
12000    if (json.has("measureScore"))
12001      res.setMeasureScoreElement(parseDecimal(json.get("measureScore").getAsBigDecimal()));
12002    if (json.has("_measureScore"))
12003      parseElementProperties(getJObject(json, "_measureScore"), res.getMeasureScoreElement());
12004    if (json.has("stratifier")) {
12005      JsonArray array = json.getAsJsonArray("stratifier");
12006      for (int i = 0; i < array.size(); i++) {
12007        res.getStratifier().add(parseMeasureReportMeasureReportGroupStratifierComponent(array.get(i).getAsJsonObject(), owner));
12008      }
12009    };
12010  }
12011
12012  protected MeasureReport.MeasureReportGroupPopulationComponent parseMeasureReportMeasureReportGroupPopulationComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
12013    MeasureReport.MeasureReportGroupPopulationComponent res = new MeasureReport.MeasureReportGroupPopulationComponent();
12014    parseMeasureReportMeasureReportGroupPopulationComponentProperties(json, owner, res);
12015    return res;
12016  }
12017
12018  protected void parseMeasureReportMeasureReportGroupPopulationComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.MeasureReportGroupPopulationComponent res) throws IOException, FHIRFormatError {
12019    parseBackboneProperties(json, res);
12020    if (json.has("identifier"))
12021      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
12022    if (json.has("code"))
12023      res.setCode(parseCodeableConcept(getJObject(json, "code")));
12024    if (json.has("count"))
12025      res.setCountElement(parseInteger(json.get("count").getAsLong()));
12026    if (json.has("_count"))
12027      parseElementProperties(getJObject(json, "_count"), res.getCountElement());
12028    if (json.has("patients"))
12029      res.setPatients(parseReference(getJObject(json, "patients")));
12030  }
12031
12032  protected MeasureReport.MeasureReportGroupStratifierComponent parseMeasureReportMeasureReportGroupStratifierComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
12033    MeasureReport.MeasureReportGroupStratifierComponent res = new MeasureReport.MeasureReportGroupStratifierComponent();
12034    parseMeasureReportMeasureReportGroupStratifierComponentProperties(json, owner, res);
12035    return res;
12036  }
12037
12038  protected void parseMeasureReportMeasureReportGroupStratifierComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.MeasureReportGroupStratifierComponent res) throws IOException, FHIRFormatError {
12039    parseBackboneProperties(json, res);
12040    if (json.has("identifier"))
12041      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
12042    if (json.has("stratum")) {
12043      JsonArray array = json.getAsJsonArray("stratum");
12044      for (int i = 0; i < array.size(); i++) {
12045        res.getStratum().add(parseMeasureReportStratifierGroupComponent(array.get(i).getAsJsonObject(), owner));
12046      }
12047    };
12048  }
12049
12050  protected MeasureReport.StratifierGroupComponent parseMeasureReportStratifierGroupComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
12051    MeasureReport.StratifierGroupComponent res = new MeasureReport.StratifierGroupComponent();
12052    parseMeasureReportStratifierGroupComponentProperties(json, owner, res);
12053    return res;
12054  }
12055
12056  protected void parseMeasureReportStratifierGroupComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.StratifierGroupComponent res) throws IOException, FHIRFormatError {
12057    parseBackboneProperties(json, res);
12058    if (json.has("value"))
12059      res.setValueElement(parseString(json.get("value").getAsString()));
12060    if (json.has("_value"))
12061      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
12062    if (json.has("population")) {
12063      JsonArray array = json.getAsJsonArray("population");
12064      for (int i = 0; i < array.size(); i++) {
12065        res.getPopulation().add(parseMeasureReportStratifierGroupPopulationComponent(array.get(i).getAsJsonObject(), owner));
12066      }
12067    };
12068    if (json.has("measureScore"))
12069      res.setMeasureScoreElement(parseDecimal(json.get("measureScore").getAsBigDecimal()));
12070    if (json.has("_measureScore"))
12071      parseElementProperties(getJObject(json, "_measureScore"), res.getMeasureScoreElement());
12072  }
12073
12074  protected MeasureReport.StratifierGroupPopulationComponent parseMeasureReportStratifierGroupPopulationComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
12075    MeasureReport.StratifierGroupPopulationComponent res = new MeasureReport.StratifierGroupPopulationComponent();
12076    parseMeasureReportStratifierGroupPopulationComponentProperties(json, owner, res);
12077    return res;
12078  }
12079
12080  protected void parseMeasureReportStratifierGroupPopulationComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.StratifierGroupPopulationComponent res) throws IOException, FHIRFormatError {
12081    parseBackboneProperties(json, res);
12082    if (json.has("identifier"))
12083      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
12084    if (json.has("code"))
12085      res.setCode(parseCodeableConcept(getJObject(json, "code")));
12086    if (json.has("count"))
12087      res.setCountElement(parseInteger(json.get("count").getAsLong()));
12088    if (json.has("_count"))
12089      parseElementProperties(getJObject(json, "_count"), res.getCountElement());
12090    if (json.has("patients"))
12091      res.setPatients(parseReference(getJObject(json, "patients")));
12092  }
12093
12094  protected Media parseMedia(JsonObject json) throws IOException, FHIRFormatError {
12095    Media res = new Media();
12096    parseMediaProperties(json, res);
12097    return res;
12098  }
12099
12100  protected void parseMediaProperties(JsonObject json, Media res) throws IOException, FHIRFormatError {
12101    parseDomainResourceProperties(json, res);
12102    if (json.has("identifier")) {
12103      JsonArray array = json.getAsJsonArray("identifier");
12104      for (int i = 0; i < array.size(); i++) {
12105        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12106      }
12107    };
12108    if (json.has("basedOn")) {
12109      JsonArray array = json.getAsJsonArray("basedOn");
12110      for (int i = 0; i < array.size(); i++) {
12111        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
12112      }
12113    };
12114    if (json.has("type"))
12115      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Media.DigitalMediaType.NULL, new Media.DigitalMediaTypeEnumFactory()));
12116    if (json.has("_type"))
12117      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
12118    if (json.has("subtype"))
12119      res.setSubtype(parseCodeableConcept(getJObject(json, "subtype")));
12120    if (json.has("view"))
12121      res.setView(parseCodeableConcept(getJObject(json, "view")));
12122    if (json.has("subject"))
12123      res.setSubject(parseReference(getJObject(json, "subject")));
12124    if (json.has("context"))
12125      res.setContext(parseReference(getJObject(json, "context")));
12126    Type occurrence = parseType("occurrence", json);
12127    if (occurrence != null)
12128      res.setOccurrence(occurrence);
12129    if (json.has("operator"))
12130      res.setOperator(parseReference(getJObject(json, "operator")));
12131    if (json.has("reasonCode")) {
12132      JsonArray array = json.getAsJsonArray("reasonCode");
12133      for (int i = 0; i < array.size(); i++) {
12134        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12135      }
12136    };
12137    if (json.has("bodySite"))
12138      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
12139    if (json.has("device"))
12140      res.setDevice(parseReference(getJObject(json, "device")));
12141    if (json.has("height"))
12142      res.setHeightElement(parsePositiveInt(json.get("height").getAsString()));
12143    if (json.has("_height"))
12144      parseElementProperties(getJObject(json, "_height"), res.getHeightElement());
12145    if (json.has("width"))
12146      res.setWidthElement(parsePositiveInt(json.get("width").getAsString()));
12147    if (json.has("_width"))
12148      parseElementProperties(getJObject(json, "_width"), res.getWidthElement());
12149    if (json.has("frames"))
12150      res.setFramesElement(parsePositiveInt(json.get("frames").getAsString()));
12151    if (json.has("_frames"))
12152      parseElementProperties(getJObject(json, "_frames"), res.getFramesElement());
12153    if (json.has("duration"))
12154      res.setDurationElement(parseUnsignedInt(json.get("duration").getAsString()));
12155    if (json.has("_duration"))
12156      parseElementProperties(getJObject(json, "_duration"), res.getDurationElement());
12157    if (json.has("content"))
12158      res.setContent(parseAttachment(getJObject(json, "content")));
12159    if (json.has("note")) {
12160      JsonArray array = json.getAsJsonArray("note");
12161      for (int i = 0; i < array.size(); i++) {
12162        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12163      }
12164    };
12165  }
12166
12167  protected Medication parseMedication(JsonObject json) throws IOException, FHIRFormatError {
12168    Medication res = new Medication();
12169    parseMedicationProperties(json, res);
12170    return res;
12171  }
12172
12173  protected void parseMedicationProperties(JsonObject json, Medication res) throws IOException, FHIRFormatError {
12174    parseDomainResourceProperties(json, res);
12175    if (json.has("code"))
12176      res.setCode(parseCodeableConcept(getJObject(json, "code")));
12177    if (json.has("status"))
12178      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Medication.MedicationStatus.NULL, new Medication.MedicationStatusEnumFactory()));
12179    if (json.has("_status"))
12180      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
12181    if (json.has("isBrand"))
12182      res.setIsBrandElement(parseBoolean(json.get("isBrand").getAsBoolean()));
12183    if (json.has("_isBrand"))
12184      parseElementProperties(getJObject(json, "_isBrand"), res.getIsBrandElement());
12185    if (json.has("isOverTheCounter"))
12186      res.setIsOverTheCounterElement(parseBoolean(json.get("isOverTheCounter").getAsBoolean()));
12187    if (json.has("_isOverTheCounter"))
12188      parseElementProperties(getJObject(json, "_isOverTheCounter"), res.getIsOverTheCounterElement());
12189    if (json.has("manufacturer"))
12190      res.setManufacturer(parseReference(getJObject(json, "manufacturer")));
12191    if (json.has("form"))
12192      res.setForm(parseCodeableConcept(getJObject(json, "form")));
12193    if (json.has("ingredient")) {
12194      JsonArray array = json.getAsJsonArray("ingredient");
12195      for (int i = 0; i < array.size(); i++) {
12196        res.getIngredient().add(parseMedicationMedicationIngredientComponent(array.get(i).getAsJsonObject(), res));
12197      }
12198    };
12199    if (json.has("package"))
12200      res.setPackage(parseMedicationMedicationPackageComponent(getJObject(json, "package"), res));
12201    if (json.has("image")) {
12202      JsonArray array = json.getAsJsonArray("image");
12203      for (int i = 0; i < array.size(); i++) {
12204        res.getImage().add(parseAttachment(array.get(i).getAsJsonObject()));
12205      }
12206    };
12207  }
12208
12209  protected Medication.MedicationIngredientComponent parseMedicationMedicationIngredientComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
12210    Medication.MedicationIngredientComponent res = new Medication.MedicationIngredientComponent();
12211    parseMedicationMedicationIngredientComponentProperties(json, owner, res);
12212    return res;
12213  }
12214
12215  protected void parseMedicationMedicationIngredientComponentProperties(JsonObject json, Medication owner, Medication.MedicationIngredientComponent res) throws IOException, FHIRFormatError {
12216    parseBackboneProperties(json, res);
12217    Type item = parseType("item", json);
12218    if (item != null)
12219      res.setItem(item);
12220    if (json.has("isActive"))
12221      res.setIsActiveElement(parseBoolean(json.get("isActive").getAsBoolean()));
12222    if (json.has("_isActive"))
12223      parseElementProperties(getJObject(json, "_isActive"), res.getIsActiveElement());
12224    if (json.has("amount"))
12225      res.setAmount(parseRatio(getJObject(json, "amount")));
12226  }
12227
12228  protected Medication.MedicationPackageComponent parseMedicationMedicationPackageComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
12229    Medication.MedicationPackageComponent res = new Medication.MedicationPackageComponent();
12230    parseMedicationMedicationPackageComponentProperties(json, owner, res);
12231    return res;
12232  }
12233
12234  protected void parseMedicationMedicationPackageComponentProperties(JsonObject json, Medication owner, Medication.MedicationPackageComponent res) throws IOException, FHIRFormatError {
12235    parseBackboneProperties(json, res);
12236    if (json.has("container"))
12237      res.setContainer(parseCodeableConcept(getJObject(json, "container")));
12238    if (json.has("content")) {
12239      JsonArray array = json.getAsJsonArray("content");
12240      for (int i = 0; i < array.size(); i++) {
12241        res.getContent().add(parseMedicationMedicationPackageContentComponent(array.get(i).getAsJsonObject(), owner));
12242      }
12243    };
12244    if (json.has("batch")) {
12245      JsonArray array = json.getAsJsonArray("batch");
12246      for (int i = 0; i < array.size(); i++) {
12247        res.getBatch().add(parseMedicationMedicationPackageBatchComponent(array.get(i).getAsJsonObject(), owner));
12248      }
12249    };
12250  }
12251
12252  protected Medication.MedicationPackageContentComponent parseMedicationMedicationPackageContentComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
12253    Medication.MedicationPackageContentComponent res = new Medication.MedicationPackageContentComponent();
12254    parseMedicationMedicationPackageContentComponentProperties(json, owner, res);
12255    return res;
12256  }
12257
12258  protected void parseMedicationMedicationPackageContentComponentProperties(JsonObject json, Medication owner, Medication.MedicationPackageContentComponent res) throws IOException, FHIRFormatError {
12259    parseBackboneProperties(json, res);
12260    Type item = parseType("item", json);
12261    if (item != null)
12262      res.setItem(item);
12263    if (json.has("amount"))
12264      res.setAmount(parseSimpleQuantity(getJObject(json, "amount")));
12265  }
12266
12267  protected Medication.MedicationPackageBatchComponent parseMedicationMedicationPackageBatchComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
12268    Medication.MedicationPackageBatchComponent res = new Medication.MedicationPackageBatchComponent();
12269    parseMedicationMedicationPackageBatchComponentProperties(json, owner, res);
12270    return res;
12271  }
12272
12273  protected void parseMedicationMedicationPackageBatchComponentProperties(JsonObject json, Medication owner, Medication.MedicationPackageBatchComponent res) throws IOException, FHIRFormatError {
12274    parseBackboneProperties(json, res);
12275    if (json.has("lotNumber"))
12276      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
12277    if (json.has("_lotNumber"))
12278      parseElementProperties(getJObject(json, "_lotNumber"), res.getLotNumberElement());
12279    if (json.has("expirationDate"))
12280      res.setExpirationDateElement(parseDateTime(json.get("expirationDate").getAsString()));
12281    if (json.has("_expirationDate"))
12282      parseElementProperties(getJObject(json, "_expirationDate"), res.getExpirationDateElement());
12283  }
12284
12285  protected MedicationAdministration parseMedicationAdministration(JsonObject json) throws IOException, FHIRFormatError {
12286    MedicationAdministration res = new MedicationAdministration();
12287    parseMedicationAdministrationProperties(json, res);
12288    return res;
12289  }
12290
12291  protected void parseMedicationAdministrationProperties(JsonObject json, MedicationAdministration res) throws IOException, FHIRFormatError {
12292    parseDomainResourceProperties(json, res);
12293    if (json.has("identifier")) {
12294      JsonArray array = json.getAsJsonArray("identifier");
12295      for (int i = 0; i < array.size(); i++) {
12296        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12297      }
12298    };
12299    if (json.has("definition")) {
12300      JsonArray array = json.getAsJsonArray("definition");
12301      for (int i = 0; i < array.size(); i++) {
12302        res.getDefinition().add(parseReference(array.get(i).getAsJsonObject()));
12303      }
12304    };
12305    if (json.has("partOf")) {
12306      JsonArray array = json.getAsJsonArray("partOf");
12307      for (int i = 0; i < array.size(); i++) {
12308        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
12309      }
12310    };
12311    if (json.has("status"))
12312      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationAdministration.MedicationAdministrationStatus.NULL, new MedicationAdministration.MedicationAdministrationStatusEnumFactory()));
12313    if (json.has("_status"))
12314      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
12315    if (json.has("category"))
12316      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
12317    Type medication = parseType("medication", json);
12318    if (medication != null)
12319      res.setMedication(medication);
12320    if (json.has("subject"))
12321      res.setSubject(parseReference(getJObject(json, "subject")));
12322    if (json.has("context"))
12323      res.setContext(parseReference(getJObject(json, "context")));
12324    if (json.has("supportingInformation")) {
12325      JsonArray array = json.getAsJsonArray("supportingInformation");
12326      for (int i = 0; i < array.size(); i++) {
12327        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
12328      }
12329    };
12330    Type effective = parseType("effective", json);
12331    if (effective != null)
12332      res.setEffective(effective);
12333    if (json.has("performer")) {
12334      JsonArray array = json.getAsJsonArray("performer");
12335      for (int i = 0; i < array.size(); i++) {
12336        res.getPerformer().add(parseMedicationAdministrationMedicationAdministrationPerformerComponent(array.get(i).getAsJsonObject(), res));
12337      }
12338    };
12339    if (json.has("notGiven"))
12340      res.setNotGivenElement(parseBoolean(json.get("notGiven").getAsBoolean()));
12341    if (json.has("_notGiven"))
12342      parseElementProperties(getJObject(json, "_notGiven"), res.getNotGivenElement());
12343    if (json.has("reasonNotGiven")) {
12344      JsonArray array = json.getAsJsonArray("reasonNotGiven");
12345      for (int i = 0; i < array.size(); i++) {
12346        res.getReasonNotGiven().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12347      }
12348    };
12349    if (json.has("reasonCode")) {
12350      JsonArray array = json.getAsJsonArray("reasonCode");
12351      for (int i = 0; i < array.size(); i++) {
12352        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12353      }
12354    };
12355    if (json.has("reasonReference")) {
12356      JsonArray array = json.getAsJsonArray("reasonReference");
12357      for (int i = 0; i < array.size(); i++) {
12358        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
12359      }
12360    };
12361    if (json.has("prescription"))
12362      res.setPrescription(parseReference(getJObject(json, "prescription")));
12363    if (json.has("device")) {
12364      JsonArray array = json.getAsJsonArray("device");
12365      for (int i = 0; i < array.size(); i++) {
12366        res.getDevice().add(parseReference(array.get(i).getAsJsonObject()));
12367      }
12368    };
12369    if (json.has("note")) {
12370      JsonArray array = json.getAsJsonArray("note");
12371      for (int i = 0; i < array.size(); i++) {
12372        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12373      }
12374    };
12375    if (json.has("dosage"))
12376      res.setDosage(parseMedicationAdministrationMedicationAdministrationDosageComponent(getJObject(json, "dosage"), res));
12377    if (json.has("eventHistory")) {
12378      JsonArray array = json.getAsJsonArray("eventHistory");
12379      for (int i = 0; i < array.size(); i++) {
12380        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
12381      }
12382    };
12383  }
12384
12385  protected MedicationAdministration.MedicationAdministrationPerformerComponent parseMedicationAdministrationMedicationAdministrationPerformerComponent(JsonObject json, MedicationAdministration owner) throws IOException, FHIRFormatError {
12386    MedicationAdministration.MedicationAdministrationPerformerComponent res = new MedicationAdministration.MedicationAdministrationPerformerComponent();
12387    parseMedicationAdministrationMedicationAdministrationPerformerComponentProperties(json, owner, res);
12388    return res;
12389  }
12390
12391  protected void parseMedicationAdministrationMedicationAdministrationPerformerComponentProperties(JsonObject json, MedicationAdministration owner, MedicationAdministration.MedicationAdministrationPerformerComponent res) throws IOException, FHIRFormatError {
12392    parseBackboneProperties(json, res);
12393    if (json.has("actor"))
12394      res.setActor(parseReference(getJObject(json, "actor")));
12395    if (json.has("onBehalfOf"))
12396      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
12397  }
12398
12399  protected MedicationAdministration.MedicationAdministrationDosageComponent parseMedicationAdministrationMedicationAdministrationDosageComponent(JsonObject json, MedicationAdministration owner) throws IOException, FHIRFormatError {
12400    MedicationAdministration.MedicationAdministrationDosageComponent res = new MedicationAdministration.MedicationAdministrationDosageComponent();
12401    parseMedicationAdministrationMedicationAdministrationDosageComponentProperties(json, owner, res);
12402    return res;
12403  }
12404
12405  protected void parseMedicationAdministrationMedicationAdministrationDosageComponentProperties(JsonObject json, MedicationAdministration owner, MedicationAdministration.MedicationAdministrationDosageComponent res) throws IOException, FHIRFormatError {
12406    parseBackboneProperties(json, res);
12407    if (json.has("text"))
12408      res.setTextElement(parseString(json.get("text").getAsString()));
12409    if (json.has("_text"))
12410      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
12411    if (json.has("site"))
12412      res.setSite(parseCodeableConcept(getJObject(json, "site")));
12413    if (json.has("route"))
12414      res.setRoute(parseCodeableConcept(getJObject(json, "route")));
12415    if (json.has("method"))
12416      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
12417    if (json.has("dose"))
12418      res.setDose(parseSimpleQuantity(getJObject(json, "dose")));
12419    Type rate = parseType("rate", json);
12420    if (rate != null)
12421      res.setRate(rate);
12422  }
12423
12424  protected MedicationDispense parseMedicationDispense(JsonObject json) throws IOException, FHIRFormatError {
12425    MedicationDispense res = new MedicationDispense();
12426    parseMedicationDispenseProperties(json, res);
12427    return res;
12428  }
12429
12430  protected void parseMedicationDispenseProperties(JsonObject json, MedicationDispense res) throws IOException, FHIRFormatError {
12431    parseDomainResourceProperties(json, res);
12432    if (json.has("identifier")) {
12433      JsonArray array = json.getAsJsonArray("identifier");
12434      for (int i = 0; i < array.size(); i++) {
12435        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12436      }
12437    };
12438    if (json.has("partOf")) {
12439      JsonArray array = json.getAsJsonArray("partOf");
12440      for (int i = 0; i < array.size(); i++) {
12441        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
12442      }
12443    };
12444    if (json.has("status"))
12445      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationDispense.MedicationDispenseStatus.NULL, new MedicationDispense.MedicationDispenseStatusEnumFactory()));
12446    if (json.has("_status"))
12447      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
12448    if (json.has("category"))
12449      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
12450    Type medication = parseType("medication", json);
12451    if (medication != null)
12452      res.setMedication(medication);
12453    if (json.has("subject"))
12454      res.setSubject(parseReference(getJObject(json, "subject")));
12455    if (json.has("context"))
12456      res.setContext(parseReference(getJObject(json, "context")));
12457    if (json.has("supportingInformation")) {
12458      JsonArray array = json.getAsJsonArray("supportingInformation");
12459      for (int i = 0; i < array.size(); i++) {
12460        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
12461      }
12462    };
12463    if (json.has("performer")) {
12464      JsonArray array = json.getAsJsonArray("performer");
12465      for (int i = 0; i < array.size(); i++) {
12466        res.getPerformer().add(parseMedicationDispenseMedicationDispensePerformerComponent(array.get(i).getAsJsonObject(), res));
12467      }
12468    };
12469    if (json.has("authorizingPrescription")) {
12470      JsonArray array = json.getAsJsonArray("authorizingPrescription");
12471      for (int i = 0; i < array.size(); i++) {
12472        res.getAuthorizingPrescription().add(parseReference(array.get(i).getAsJsonObject()));
12473      }
12474    };
12475    if (json.has("type"))
12476      res.setType(parseCodeableConcept(getJObject(json, "type")));
12477    if (json.has("quantity"))
12478      res.setQuantity(parseSimpleQuantity(getJObject(json, "quantity")));
12479    if (json.has("daysSupply"))
12480      res.setDaysSupply(parseSimpleQuantity(getJObject(json, "daysSupply")));
12481    if (json.has("whenPrepared"))
12482      res.setWhenPreparedElement(parseDateTime(json.get("whenPrepared").getAsString()));
12483    if (json.has("_whenPrepared"))
12484      parseElementProperties(getJObject(json, "_whenPrepared"), res.getWhenPreparedElement());
12485    if (json.has("whenHandedOver"))
12486      res.setWhenHandedOverElement(parseDateTime(json.get("whenHandedOver").getAsString()));
12487    if (json.has("_whenHandedOver"))
12488      parseElementProperties(getJObject(json, "_whenHandedOver"), res.getWhenHandedOverElement());
12489    if (json.has("destination"))
12490      res.setDestination(parseReference(getJObject(json, "destination")));
12491    if (json.has("receiver")) {
12492      JsonArray array = json.getAsJsonArray("receiver");
12493      for (int i = 0; i < array.size(); i++) {
12494        res.getReceiver().add(parseReference(array.get(i).getAsJsonObject()));
12495      }
12496    };
12497    if (json.has("note")) {
12498      JsonArray array = json.getAsJsonArray("note");
12499      for (int i = 0; i < array.size(); i++) {
12500        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12501      }
12502    };
12503    if (json.has("dosageInstruction")) {
12504      JsonArray array = json.getAsJsonArray("dosageInstruction");
12505      for (int i = 0; i < array.size(); i++) {
12506        res.getDosageInstruction().add(parseDosage(array.get(i).getAsJsonObject()));
12507      }
12508    };
12509    if (json.has("substitution"))
12510      res.setSubstitution(parseMedicationDispenseMedicationDispenseSubstitutionComponent(getJObject(json, "substitution"), res));
12511    if (json.has("detectedIssue")) {
12512      JsonArray array = json.getAsJsonArray("detectedIssue");
12513      for (int i = 0; i < array.size(); i++) {
12514        res.getDetectedIssue().add(parseReference(array.get(i).getAsJsonObject()));
12515      }
12516    };
12517    if (json.has("notDone"))
12518      res.setNotDoneElement(parseBoolean(json.get("notDone").getAsBoolean()));
12519    if (json.has("_notDone"))
12520      parseElementProperties(getJObject(json, "_notDone"), res.getNotDoneElement());
12521    Type notDoneReason = parseType("notDoneReason", json);
12522    if (notDoneReason != null)
12523      res.setNotDoneReason(notDoneReason);
12524    if (json.has("eventHistory")) {
12525      JsonArray array = json.getAsJsonArray("eventHistory");
12526      for (int i = 0; i < array.size(); i++) {
12527        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
12528      }
12529    };
12530  }
12531
12532  protected MedicationDispense.MedicationDispensePerformerComponent parseMedicationDispenseMedicationDispensePerformerComponent(JsonObject json, MedicationDispense owner) throws IOException, FHIRFormatError {
12533    MedicationDispense.MedicationDispensePerformerComponent res = new MedicationDispense.MedicationDispensePerformerComponent();
12534    parseMedicationDispenseMedicationDispensePerformerComponentProperties(json, owner, res);
12535    return res;
12536  }
12537
12538  protected void parseMedicationDispenseMedicationDispensePerformerComponentProperties(JsonObject json, MedicationDispense owner, MedicationDispense.MedicationDispensePerformerComponent res) throws IOException, FHIRFormatError {
12539    parseBackboneProperties(json, res);
12540    if (json.has("actor"))
12541      res.setActor(parseReference(getJObject(json, "actor")));
12542    if (json.has("onBehalfOf"))
12543      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
12544  }
12545
12546  protected MedicationDispense.MedicationDispenseSubstitutionComponent parseMedicationDispenseMedicationDispenseSubstitutionComponent(JsonObject json, MedicationDispense owner) throws IOException, FHIRFormatError {
12547    MedicationDispense.MedicationDispenseSubstitutionComponent res = new MedicationDispense.MedicationDispenseSubstitutionComponent();
12548    parseMedicationDispenseMedicationDispenseSubstitutionComponentProperties(json, owner, res);
12549    return res;
12550  }
12551
12552  protected void parseMedicationDispenseMedicationDispenseSubstitutionComponentProperties(JsonObject json, MedicationDispense owner, MedicationDispense.MedicationDispenseSubstitutionComponent res) throws IOException, FHIRFormatError {
12553    parseBackboneProperties(json, res);
12554    if (json.has("wasSubstituted"))
12555      res.setWasSubstitutedElement(parseBoolean(json.get("wasSubstituted").getAsBoolean()));
12556    if (json.has("_wasSubstituted"))
12557      parseElementProperties(getJObject(json, "_wasSubstituted"), res.getWasSubstitutedElement());
12558    if (json.has("type"))
12559      res.setType(parseCodeableConcept(getJObject(json, "type")));
12560    if (json.has("reason")) {
12561      JsonArray array = json.getAsJsonArray("reason");
12562      for (int i = 0; i < array.size(); i++) {
12563        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12564      }
12565    };
12566    if (json.has("responsibleParty")) {
12567      JsonArray array = json.getAsJsonArray("responsibleParty");
12568      for (int i = 0; i < array.size(); i++) {
12569        res.getResponsibleParty().add(parseReference(array.get(i).getAsJsonObject()));
12570      }
12571    };
12572  }
12573
12574  protected MedicationRequest parseMedicationRequest(JsonObject json) throws IOException, FHIRFormatError {
12575    MedicationRequest res = new MedicationRequest();
12576    parseMedicationRequestProperties(json, res);
12577    return res;
12578  }
12579
12580  protected void parseMedicationRequestProperties(JsonObject json, MedicationRequest res) throws IOException, FHIRFormatError {
12581    parseDomainResourceProperties(json, res);
12582    if (json.has("identifier")) {
12583      JsonArray array = json.getAsJsonArray("identifier");
12584      for (int i = 0; i < array.size(); i++) {
12585        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12586      }
12587    };
12588    if (json.has("definition")) {
12589      JsonArray array = json.getAsJsonArray("definition");
12590      for (int i = 0; i < array.size(); i++) {
12591        res.getDefinition().add(parseReference(array.get(i).getAsJsonObject()));
12592      }
12593    };
12594    if (json.has("basedOn")) {
12595      JsonArray array = json.getAsJsonArray("basedOn");
12596      for (int i = 0; i < array.size(); i++) {
12597        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
12598      }
12599    };
12600    if (json.has("groupIdentifier"))
12601      res.setGroupIdentifier(parseIdentifier(getJObject(json, "groupIdentifier")));
12602    if (json.has("status"))
12603      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationRequest.MedicationRequestStatus.NULL, new MedicationRequest.MedicationRequestStatusEnumFactory()));
12604    if (json.has("_status"))
12605      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
12606    if (json.has("intent"))
12607      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), MedicationRequest.MedicationRequestIntent.NULL, new MedicationRequest.MedicationRequestIntentEnumFactory()));
12608    if (json.has("_intent"))
12609      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
12610    if (json.has("category"))
12611      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
12612    if (json.has("priority"))
12613      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), MedicationRequest.MedicationRequestPriority.NULL, new MedicationRequest.MedicationRequestPriorityEnumFactory()));
12614    if (json.has("_priority"))
12615      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
12616    Type medication = parseType("medication", json);
12617    if (medication != null)
12618      res.setMedication(medication);
12619    if (json.has("subject"))
12620      res.setSubject(parseReference(getJObject(json, "subject")));
12621    if (json.has("context"))
12622      res.setContext(parseReference(getJObject(json, "context")));
12623    if (json.has("supportingInformation")) {
12624      JsonArray array = json.getAsJsonArray("supportingInformation");
12625      for (int i = 0; i < array.size(); i++) {
12626        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
12627      }
12628    };
12629    if (json.has("authoredOn"))
12630      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
12631    if (json.has("_authoredOn"))
12632      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
12633    if (json.has("requester"))
12634      res.setRequester(parseMedicationRequestMedicationRequestRequesterComponent(getJObject(json, "requester"), res));
12635    if (json.has("recorder"))
12636      res.setRecorder(parseReference(getJObject(json, "recorder")));
12637    if (json.has("reasonCode")) {
12638      JsonArray array = json.getAsJsonArray("reasonCode");
12639      for (int i = 0; i < array.size(); i++) {
12640        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12641      }
12642    };
12643    if (json.has("reasonReference")) {
12644      JsonArray array = json.getAsJsonArray("reasonReference");
12645      for (int i = 0; i < array.size(); i++) {
12646        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
12647      }
12648    };
12649    if (json.has("note")) {
12650      JsonArray array = json.getAsJsonArray("note");
12651      for (int i = 0; i < array.size(); i++) {
12652        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12653      }
12654    };
12655    if (json.has("dosageInstruction")) {
12656      JsonArray array = json.getAsJsonArray("dosageInstruction");
12657      for (int i = 0; i < array.size(); i++) {
12658        res.getDosageInstruction().add(parseDosage(array.get(i).getAsJsonObject()));
12659      }
12660    };
12661    if (json.has("dispenseRequest"))
12662      res.setDispenseRequest(parseMedicationRequestMedicationRequestDispenseRequestComponent(getJObject(json, "dispenseRequest"), res));
12663    if (json.has("substitution"))
12664      res.setSubstitution(parseMedicationRequestMedicationRequestSubstitutionComponent(getJObject(json, "substitution"), res));
12665    if (json.has("priorPrescription"))
12666      res.setPriorPrescription(parseReference(getJObject(json, "priorPrescription")));
12667    if (json.has("detectedIssue")) {
12668      JsonArray array = json.getAsJsonArray("detectedIssue");
12669      for (int i = 0; i < array.size(); i++) {
12670        res.getDetectedIssue().add(parseReference(array.get(i).getAsJsonObject()));
12671      }
12672    };
12673    if (json.has("eventHistory")) {
12674      JsonArray array = json.getAsJsonArray("eventHistory");
12675      for (int i = 0; i < array.size(); i++) {
12676        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
12677      }
12678    };
12679  }
12680
12681  protected MedicationRequest.MedicationRequestRequesterComponent parseMedicationRequestMedicationRequestRequesterComponent(JsonObject json, MedicationRequest owner) throws IOException, FHIRFormatError {
12682    MedicationRequest.MedicationRequestRequesterComponent res = new MedicationRequest.MedicationRequestRequesterComponent();
12683    parseMedicationRequestMedicationRequestRequesterComponentProperties(json, owner, res);
12684    return res;
12685  }
12686
12687  protected void parseMedicationRequestMedicationRequestRequesterComponentProperties(JsonObject json, MedicationRequest owner, MedicationRequest.MedicationRequestRequesterComponent res) throws IOException, FHIRFormatError {
12688    parseBackboneProperties(json, res);
12689    if (json.has("agent"))
12690      res.setAgent(parseReference(getJObject(json, "agent")));
12691    if (json.has("onBehalfOf"))
12692      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
12693  }
12694
12695  protected MedicationRequest.MedicationRequestDispenseRequestComponent parseMedicationRequestMedicationRequestDispenseRequestComponent(JsonObject json, MedicationRequest owner) throws IOException, FHIRFormatError {
12696    MedicationRequest.MedicationRequestDispenseRequestComponent res = new MedicationRequest.MedicationRequestDispenseRequestComponent();
12697    parseMedicationRequestMedicationRequestDispenseRequestComponentProperties(json, owner, res);
12698    return res;
12699  }
12700
12701  protected void parseMedicationRequestMedicationRequestDispenseRequestComponentProperties(JsonObject json, MedicationRequest owner, MedicationRequest.MedicationRequestDispenseRequestComponent res) throws IOException, FHIRFormatError {
12702    parseBackboneProperties(json, res);
12703    if (json.has("validityPeriod"))
12704      res.setValidityPeriod(parsePeriod(getJObject(json, "validityPeriod")));
12705    if (json.has("numberOfRepeatsAllowed"))
12706      res.setNumberOfRepeatsAllowedElement(parsePositiveInt(json.get("numberOfRepeatsAllowed").getAsString()));
12707    if (json.has("_numberOfRepeatsAllowed"))
12708      parseElementProperties(getJObject(json, "_numberOfRepeatsAllowed"), res.getNumberOfRepeatsAllowedElement());
12709    if (json.has("quantity"))
12710      res.setQuantity(parseSimpleQuantity(getJObject(json, "quantity")));
12711    if (json.has("expectedSupplyDuration"))
12712      res.setExpectedSupplyDuration(parseDuration(getJObject(json, "expectedSupplyDuration")));
12713    if (json.has("performer"))
12714      res.setPerformer(parseReference(getJObject(json, "performer")));
12715  }
12716
12717  protected MedicationRequest.MedicationRequestSubstitutionComponent parseMedicationRequestMedicationRequestSubstitutionComponent(JsonObject json, MedicationRequest owner) throws IOException, FHIRFormatError {
12718    MedicationRequest.MedicationRequestSubstitutionComponent res = new MedicationRequest.MedicationRequestSubstitutionComponent();
12719    parseMedicationRequestMedicationRequestSubstitutionComponentProperties(json, owner, res);
12720    return res;
12721  }
12722
12723  protected void parseMedicationRequestMedicationRequestSubstitutionComponentProperties(JsonObject json, MedicationRequest owner, MedicationRequest.MedicationRequestSubstitutionComponent res) throws IOException, FHIRFormatError {
12724    parseBackboneProperties(json, res);
12725    if (json.has("allowed"))
12726      res.setAllowedElement(parseBoolean(json.get("allowed").getAsBoolean()));
12727    if (json.has("_allowed"))
12728      parseElementProperties(getJObject(json, "_allowed"), res.getAllowedElement());
12729    if (json.has("reason"))
12730      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
12731  }
12732
12733  protected MedicationStatement parseMedicationStatement(JsonObject json) throws IOException, FHIRFormatError {
12734    MedicationStatement res = new MedicationStatement();
12735    parseMedicationStatementProperties(json, res);
12736    return res;
12737  }
12738
12739  protected void parseMedicationStatementProperties(JsonObject json, MedicationStatement res) throws IOException, FHIRFormatError {
12740    parseDomainResourceProperties(json, res);
12741    if (json.has("identifier")) {
12742      JsonArray array = json.getAsJsonArray("identifier");
12743      for (int i = 0; i < array.size(); i++) {
12744        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12745      }
12746    };
12747    if (json.has("basedOn")) {
12748      JsonArray array = json.getAsJsonArray("basedOn");
12749      for (int i = 0; i < array.size(); i++) {
12750        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
12751      }
12752    };
12753    if (json.has("partOf")) {
12754      JsonArray array = json.getAsJsonArray("partOf");
12755      for (int i = 0; i < array.size(); i++) {
12756        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
12757      }
12758    };
12759    if (json.has("context"))
12760      res.setContext(parseReference(getJObject(json, "context")));
12761    if (json.has("status"))
12762      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationStatement.MedicationStatementStatus.NULL, new MedicationStatement.MedicationStatementStatusEnumFactory()));
12763    if (json.has("_status"))
12764      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
12765    if (json.has("category"))
12766      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
12767    Type medication = parseType("medication", json);
12768    if (medication != null)
12769      res.setMedication(medication);
12770    Type effective = parseType("effective", json);
12771    if (effective != null)
12772      res.setEffective(effective);
12773    if (json.has("dateAsserted"))
12774      res.setDateAssertedElement(parseDateTime(json.get("dateAsserted").getAsString()));
12775    if (json.has("_dateAsserted"))
12776      parseElementProperties(getJObject(json, "_dateAsserted"), res.getDateAssertedElement());
12777    if (json.has("informationSource"))
12778      res.setInformationSource(parseReference(getJObject(json, "informationSource")));
12779    if (json.has("subject"))
12780      res.setSubject(parseReference(getJObject(json, "subject")));
12781    if (json.has("derivedFrom")) {
12782      JsonArray array = json.getAsJsonArray("derivedFrom");
12783      for (int i = 0; i < array.size(); i++) {
12784        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
12785      }
12786    };
12787    if (json.has("taken"))
12788      res.setTakenElement(parseEnumeration(json.get("taken").getAsString(), MedicationStatement.MedicationStatementTaken.NULL, new MedicationStatement.MedicationStatementTakenEnumFactory()));
12789    if (json.has("_taken"))
12790      parseElementProperties(getJObject(json, "_taken"), res.getTakenElement());
12791    if (json.has("reasonNotTaken")) {
12792      JsonArray array = json.getAsJsonArray("reasonNotTaken");
12793      for (int i = 0; i < array.size(); i++) {
12794        res.getReasonNotTaken().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12795      }
12796    };
12797    if (json.has("reasonCode")) {
12798      JsonArray array = json.getAsJsonArray("reasonCode");
12799      for (int i = 0; i < array.size(); i++) {
12800        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12801      }
12802    };
12803    if (json.has("reasonReference")) {
12804      JsonArray array = json.getAsJsonArray("reasonReference");
12805      for (int i = 0; i < array.size(); i++) {
12806        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
12807      }
12808    };
12809    if (json.has("note")) {
12810      JsonArray array = json.getAsJsonArray("note");
12811      for (int i = 0; i < array.size(); i++) {
12812        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12813      }
12814    };
12815    if (json.has("dosage")) {
12816      JsonArray array = json.getAsJsonArray("dosage");
12817      for (int i = 0; i < array.size(); i++) {
12818        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
12819      }
12820    };
12821  }
12822
12823  protected MessageDefinition parseMessageDefinition(JsonObject json) throws IOException, FHIRFormatError {
12824    MessageDefinition res = new MessageDefinition();
12825    parseMessageDefinitionProperties(json, res);
12826    return res;
12827  }
12828
12829  protected void parseMessageDefinitionProperties(JsonObject json, MessageDefinition res) throws IOException, FHIRFormatError {
12830    parseDomainResourceProperties(json, res);
12831    if (json.has("url"))
12832      res.setUrlElement(parseUri(json.get("url").getAsString()));
12833    if (json.has("_url"))
12834      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
12835    if (json.has("identifier"))
12836      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
12837    if (json.has("version"))
12838      res.setVersionElement(parseString(json.get("version").getAsString()));
12839    if (json.has("_version"))
12840      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
12841    if (json.has("name"))
12842      res.setNameElement(parseString(json.get("name").getAsString()));
12843    if (json.has("_name"))
12844      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
12845    if (json.has("title"))
12846      res.setTitleElement(parseString(json.get("title").getAsString()));
12847    if (json.has("_title"))
12848      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
12849    if (json.has("status"))
12850      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
12851    if (json.has("_status"))
12852      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
12853    if (json.has("experimental"))
12854      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
12855    if (json.has("_experimental"))
12856      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
12857    if (json.has("date"))
12858      res.setDateElement(parseDateTime(json.get("date").getAsString()));
12859    if (json.has("_date"))
12860      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
12861    if (json.has("publisher"))
12862      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
12863    if (json.has("_publisher"))
12864      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
12865    if (json.has("contact")) {
12866      JsonArray array = json.getAsJsonArray("contact");
12867      for (int i = 0; i < array.size(); i++) {
12868        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
12869      }
12870    };
12871    if (json.has("description"))
12872      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12873    if (json.has("_description"))
12874      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
12875    if (json.has("useContext")) {
12876      JsonArray array = json.getAsJsonArray("useContext");
12877      for (int i = 0; i < array.size(); i++) {
12878        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
12879      }
12880    };
12881    if (json.has("jurisdiction")) {
12882      JsonArray array = json.getAsJsonArray("jurisdiction");
12883      for (int i = 0; i < array.size(); i++) {
12884        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12885      }
12886    };
12887    if (json.has("purpose"))
12888      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
12889    if (json.has("_purpose"))
12890      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
12891    if (json.has("copyright"))
12892      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
12893    if (json.has("_copyright"))
12894      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
12895    if (json.has("base"))
12896      res.setBase(parseReference(getJObject(json, "base")));
12897    if (json.has("parent")) {
12898      JsonArray array = json.getAsJsonArray("parent");
12899      for (int i = 0; i < array.size(); i++) {
12900        res.getParent().add(parseReference(array.get(i).getAsJsonObject()));
12901      }
12902    };
12903    if (json.has("replaces")) {
12904      JsonArray array = json.getAsJsonArray("replaces");
12905      for (int i = 0; i < array.size(); i++) {
12906        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
12907      }
12908    };
12909    if (json.has("event"))
12910      res.setEvent(parseCoding(getJObject(json, "event")));
12911    if (json.has("category"))
12912      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), MessageDefinition.MessageSignificanceCategory.NULL, new MessageDefinition.MessageSignificanceCategoryEnumFactory()));
12913    if (json.has("_category"))
12914      parseElementProperties(getJObject(json, "_category"), res.getCategoryElement());
12915    if (json.has("focus")) {
12916      JsonArray array = json.getAsJsonArray("focus");
12917      for (int i = 0; i < array.size(); i++) {
12918        res.getFocus().add(parseMessageDefinitionMessageDefinitionFocusComponent(array.get(i).getAsJsonObject(), res));
12919      }
12920    };
12921    if (json.has("responseRequired"))
12922      res.setResponseRequiredElement(parseBoolean(json.get("responseRequired").getAsBoolean()));
12923    if (json.has("_responseRequired"))
12924      parseElementProperties(getJObject(json, "_responseRequired"), res.getResponseRequiredElement());
12925    if (json.has("allowedResponse")) {
12926      JsonArray array = json.getAsJsonArray("allowedResponse");
12927      for (int i = 0; i < array.size(); i++) {
12928        res.getAllowedResponse().add(parseMessageDefinitionMessageDefinitionAllowedResponseComponent(array.get(i).getAsJsonObject(), res));
12929      }
12930    };
12931  }
12932
12933  protected MessageDefinition.MessageDefinitionFocusComponent parseMessageDefinitionMessageDefinitionFocusComponent(JsonObject json, MessageDefinition owner) throws IOException, FHIRFormatError {
12934    MessageDefinition.MessageDefinitionFocusComponent res = new MessageDefinition.MessageDefinitionFocusComponent();
12935    parseMessageDefinitionMessageDefinitionFocusComponentProperties(json, owner, res);
12936    return res;
12937  }
12938
12939  protected void parseMessageDefinitionMessageDefinitionFocusComponentProperties(JsonObject json, MessageDefinition owner, MessageDefinition.MessageDefinitionFocusComponent res) throws IOException, FHIRFormatError {
12940    parseBackboneProperties(json, res);
12941    if (json.has("code"))
12942      res.setCodeElement(parseCode(json.get("code").getAsString()));
12943    if (json.has("_code"))
12944      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
12945    if (json.has("profile"))
12946      res.setProfile(parseReference(getJObject(json, "profile")));
12947    if (json.has("min"))
12948      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
12949    if (json.has("_min"))
12950      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
12951    if (json.has("max"))
12952      res.setMaxElement(parseString(json.get("max").getAsString()));
12953    if (json.has("_max"))
12954      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
12955  }
12956
12957  protected MessageDefinition.MessageDefinitionAllowedResponseComponent parseMessageDefinitionMessageDefinitionAllowedResponseComponent(JsonObject json, MessageDefinition owner) throws IOException, FHIRFormatError {
12958    MessageDefinition.MessageDefinitionAllowedResponseComponent res = new MessageDefinition.MessageDefinitionAllowedResponseComponent();
12959    parseMessageDefinitionMessageDefinitionAllowedResponseComponentProperties(json, owner, res);
12960    return res;
12961  }
12962
12963  protected void parseMessageDefinitionMessageDefinitionAllowedResponseComponentProperties(JsonObject json, MessageDefinition owner, MessageDefinition.MessageDefinitionAllowedResponseComponent res) throws IOException, FHIRFormatError {
12964    parseBackboneProperties(json, res);
12965    if (json.has("message"))
12966      res.setMessage(parseReference(getJObject(json, "message")));
12967    if (json.has("situation"))
12968      res.setSituationElement(parseMarkdown(json.get("situation").getAsString()));
12969    if (json.has("_situation"))
12970      parseElementProperties(getJObject(json, "_situation"), res.getSituationElement());
12971  }
12972
12973  protected MessageHeader parseMessageHeader(JsonObject json) throws IOException, FHIRFormatError {
12974    MessageHeader res = new MessageHeader();
12975    parseMessageHeaderProperties(json, res);
12976    return res;
12977  }
12978
12979  protected void parseMessageHeaderProperties(JsonObject json, MessageHeader res) throws IOException, FHIRFormatError {
12980    parseDomainResourceProperties(json, res);
12981    if (json.has("event"))
12982      res.setEvent(parseCoding(getJObject(json, "event")));
12983    if (json.has("destination")) {
12984      JsonArray array = json.getAsJsonArray("destination");
12985      for (int i = 0; i < array.size(); i++) {
12986        res.getDestination().add(parseMessageHeaderMessageDestinationComponent(array.get(i).getAsJsonObject(), res));
12987      }
12988    };
12989    if (json.has("receiver"))
12990      res.setReceiver(parseReference(getJObject(json, "receiver")));
12991    if (json.has("sender"))
12992      res.setSender(parseReference(getJObject(json, "sender")));
12993    if (json.has("timestamp"))
12994      res.setTimestampElement(parseInstant(json.get("timestamp").getAsString()));
12995    if (json.has("_timestamp"))
12996      parseElementProperties(getJObject(json, "_timestamp"), res.getTimestampElement());
12997    if (json.has("enterer"))
12998      res.setEnterer(parseReference(getJObject(json, "enterer")));
12999    if (json.has("author"))
13000      res.setAuthor(parseReference(getJObject(json, "author")));
13001    if (json.has("source"))
13002      res.setSource(parseMessageHeaderMessageSourceComponent(getJObject(json, "source"), res));
13003    if (json.has("responsible"))
13004      res.setResponsible(parseReference(getJObject(json, "responsible")));
13005    if (json.has("reason"))
13006      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
13007    if (json.has("response"))
13008      res.setResponse(parseMessageHeaderMessageHeaderResponseComponent(getJObject(json, "response"), res));
13009    if (json.has("focus")) {
13010      JsonArray array = json.getAsJsonArray("focus");
13011      for (int i = 0; i < array.size(); i++) {
13012        res.getFocus().add(parseReference(array.get(i).getAsJsonObject()));
13013      }
13014    };
13015  }
13016
13017  protected MessageHeader.MessageDestinationComponent parseMessageHeaderMessageDestinationComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
13018    MessageHeader.MessageDestinationComponent res = new MessageHeader.MessageDestinationComponent();
13019    parseMessageHeaderMessageDestinationComponentProperties(json, owner, res);
13020    return res;
13021  }
13022
13023  protected void parseMessageHeaderMessageDestinationComponentProperties(JsonObject json, MessageHeader owner, MessageHeader.MessageDestinationComponent res) throws IOException, FHIRFormatError {
13024    parseBackboneProperties(json, res);
13025    if (json.has("name"))
13026      res.setNameElement(parseString(json.get("name").getAsString()));
13027    if (json.has("_name"))
13028      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
13029    if (json.has("target"))
13030      res.setTarget(parseReference(getJObject(json, "target")));
13031    if (json.has("endpoint"))
13032      res.setEndpointElement(parseUri(json.get("endpoint").getAsString()));
13033    if (json.has("_endpoint"))
13034      parseElementProperties(getJObject(json, "_endpoint"), res.getEndpointElement());
13035  }
13036
13037  protected MessageHeader.MessageSourceComponent parseMessageHeaderMessageSourceComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
13038    MessageHeader.MessageSourceComponent res = new MessageHeader.MessageSourceComponent();
13039    parseMessageHeaderMessageSourceComponentProperties(json, owner, res);
13040    return res;
13041  }
13042
13043  protected void parseMessageHeaderMessageSourceComponentProperties(JsonObject json, MessageHeader owner, MessageHeader.MessageSourceComponent res) throws IOException, FHIRFormatError {
13044    parseBackboneProperties(json, res);
13045    if (json.has("name"))
13046      res.setNameElement(parseString(json.get("name").getAsString()));
13047    if (json.has("_name"))
13048      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
13049    if (json.has("software"))
13050      res.setSoftwareElement(parseString(json.get("software").getAsString()));
13051    if (json.has("_software"))
13052      parseElementProperties(getJObject(json, "_software"), res.getSoftwareElement());
13053    if (json.has("version"))
13054      res.setVersionElement(parseString(json.get("version").getAsString()));
13055    if (json.has("_version"))
13056      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
13057    if (json.has("contact"))
13058      res.setContact(parseContactPoint(getJObject(json, "contact")));
13059    if (json.has("endpoint"))
13060      res.setEndpointElement(parseUri(json.get("endpoint").getAsString()));
13061    if (json.has("_endpoint"))
13062      parseElementProperties(getJObject(json, "_endpoint"), res.getEndpointElement());
13063  }
13064
13065  protected MessageHeader.MessageHeaderResponseComponent parseMessageHeaderMessageHeaderResponseComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
13066    MessageHeader.MessageHeaderResponseComponent res = new MessageHeader.MessageHeaderResponseComponent();
13067    parseMessageHeaderMessageHeaderResponseComponentProperties(json, owner, res);
13068    return res;
13069  }
13070
13071  protected void parseMessageHeaderMessageHeaderResponseComponentProperties(JsonObject json, MessageHeader owner, MessageHeader.MessageHeaderResponseComponent res) throws IOException, FHIRFormatError {
13072    parseBackboneProperties(json, res);
13073    if (json.has("identifier"))
13074      res.setIdentifierElement(parseId(json.get("identifier").getAsString()));
13075    if (json.has("_identifier"))
13076      parseElementProperties(getJObject(json, "_identifier"), res.getIdentifierElement());
13077    if (json.has("code"))
13078      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), MessageHeader.ResponseType.NULL, new MessageHeader.ResponseTypeEnumFactory()));
13079    if (json.has("_code"))
13080      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
13081    if (json.has("details"))
13082      res.setDetails(parseReference(getJObject(json, "details")));
13083  }
13084
13085  protected NamingSystem parseNamingSystem(JsonObject json) throws IOException, FHIRFormatError {
13086    NamingSystem res = new NamingSystem();
13087    parseNamingSystemProperties(json, res);
13088    return res;
13089  }
13090
13091  protected void parseNamingSystemProperties(JsonObject json, NamingSystem res) throws IOException, FHIRFormatError {
13092    parseDomainResourceProperties(json, res);
13093    if (json.has("name"))
13094      res.setNameElement(parseString(json.get("name").getAsString()));
13095    if (json.has("_name"))
13096      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
13097    if (json.has("status"))
13098      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
13099    if (json.has("_status"))
13100      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
13101    if (json.has("kind"))
13102      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), NamingSystem.NamingSystemType.NULL, new NamingSystem.NamingSystemTypeEnumFactory()));
13103    if (json.has("_kind"))
13104      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
13105    if (json.has("date"))
13106      res.setDateElement(parseDateTime(json.get("date").getAsString()));
13107    if (json.has("_date"))
13108      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
13109    if (json.has("publisher"))
13110      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
13111    if (json.has("_publisher"))
13112      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
13113    if (json.has("contact")) {
13114      JsonArray array = json.getAsJsonArray("contact");
13115      for (int i = 0; i < array.size(); i++) {
13116        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
13117      }
13118    };
13119    if (json.has("responsible"))
13120      res.setResponsibleElement(parseString(json.get("responsible").getAsString()));
13121    if (json.has("_responsible"))
13122      parseElementProperties(getJObject(json, "_responsible"), res.getResponsibleElement());
13123    if (json.has("type"))
13124      res.setType(parseCodeableConcept(getJObject(json, "type")));
13125    if (json.has("description"))
13126      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
13127    if (json.has("_description"))
13128      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
13129    if (json.has("useContext")) {
13130      JsonArray array = json.getAsJsonArray("useContext");
13131      for (int i = 0; i < array.size(); i++) {
13132        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
13133      }
13134    };
13135    if (json.has("jurisdiction")) {
13136      JsonArray array = json.getAsJsonArray("jurisdiction");
13137      for (int i = 0; i < array.size(); i++) {
13138        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13139      }
13140    };
13141    if (json.has("usage"))
13142      res.setUsageElement(parseString(json.get("usage").getAsString()));
13143    if (json.has("_usage"))
13144      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
13145    if (json.has("uniqueId")) {
13146      JsonArray array = json.getAsJsonArray("uniqueId");
13147      for (int i = 0; i < array.size(); i++) {
13148        res.getUniqueId().add(parseNamingSystemNamingSystemUniqueIdComponent(array.get(i).getAsJsonObject(), res));
13149      }
13150    };
13151    if (json.has("replacedBy"))
13152      res.setReplacedBy(parseReference(getJObject(json, "replacedBy")));
13153  }
13154
13155  protected NamingSystem.NamingSystemUniqueIdComponent parseNamingSystemNamingSystemUniqueIdComponent(JsonObject json, NamingSystem owner) throws IOException, FHIRFormatError {
13156    NamingSystem.NamingSystemUniqueIdComponent res = new NamingSystem.NamingSystemUniqueIdComponent();
13157    parseNamingSystemNamingSystemUniqueIdComponentProperties(json, owner, res);
13158    return res;
13159  }
13160
13161  protected void parseNamingSystemNamingSystemUniqueIdComponentProperties(JsonObject json, NamingSystem owner, NamingSystem.NamingSystemUniqueIdComponent res) throws IOException, FHIRFormatError {
13162    parseBackboneProperties(json, res);
13163    if (json.has("type"))
13164      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), NamingSystem.NamingSystemIdentifierType.NULL, new NamingSystem.NamingSystemIdentifierTypeEnumFactory()));
13165    if (json.has("_type"))
13166      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
13167    if (json.has("value"))
13168      res.setValueElement(parseString(json.get("value").getAsString()));
13169    if (json.has("_value"))
13170      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
13171    if (json.has("preferred"))
13172      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
13173    if (json.has("_preferred"))
13174      parseElementProperties(getJObject(json, "_preferred"), res.getPreferredElement());
13175    if (json.has("comment"))
13176      res.setCommentElement(parseString(json.get("comment").getAsString()));
13177    if (json.has("_comment"))
13178      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
13179    if (json.has("period"))
13180      res.setPeriod(parsePeriod(getJObject(json, "period")));
13181  }
13182
13183  protected NutritionOrder parseNutritionOrder(JsonObject json) throws IOException, FHIRFormatError {
13184    NutritionOrder res = new NutritionOrder();
13185    parseNutritionOrderProperties(json, res);
13186    return res;
13187  }
13188
13189  protected void parseNutritionOrderProperties(JsonObject json, NutritionOrder res) throws IOException, FHIRFormatError {
13190    parseDomainResourceProperties(json, res);
13191    if (json.has("identifier")) {
13192      JsonArray array = json.getAsJsonArray("identifier");
13193      for (int i = 0; i < array.size(); i++) {
13194        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13195      }
13196    };
13197    if (json.has("status"))
13198      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), NutritionOrder.NutritionOrderStatus.NULL, new NutritionOrder.NutritionOrderStatusEnumFactory()));
13199    if (json.has("_status"))
13200      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
13201    if (json.has("patient"))
13202      res.setPatient(parseReference(getJObject(json, "patient")));
13203    if (json.has("encounter"))
13204      res.setEncounter(parseReference(getJObject(json, "encounter")));
13205    if (json.has("dateTime"))
13206      res.setDateTimeElement(parseDateTime(json.get("dateTime").getAsString()));
13207    if (json.has("_dateTime"))
13208      parseElementProperties(getJObject(json, "_dateTime"), res.getDateTimeElement());
13209    if (json.has("orderer"))
13210      res.setOrderer(parseReference(getJObject(json, "orderer")));
13211    if (json.has("allergyIntolerance")) {
13212      JsonArray array = json.getAsJsonArray("allergyIntolerance");
13213      for (int i = 0; i < array.size(); i++) {
13214        res.getAllergyIntolerance().add(parseReference(array.get(i).getAsJsonObject()));
13215      }
13216    };
13217    if (json.has("foodPreferenceModifier")) {
13218      JsonArray array = json.getAsJsonArray("foodPreferenceModifier");
13219      for (int i = 0; i < array.size(); i++) {
13220        res.getFoodPreferenceModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13221      }
13222    };
13223    if (json.has("excludeFoodModifier")) {
13224      JsonArray array = json.getAsJsonArray("excludeFoodModifier");
13225      for (int i = 0; i < array.size(); i++) {
13226        res.getExcludeFoodModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13227      }
13228    };
13229    if (json.has("oralDiet"))
13230      res.setOralDiet(parseNutritionOrderNutritionOrderOralDietComponent(getJObject(json, "oralDiet"), res));
13231    if (json.has("supplement")) {
13232      JsonArray array = json.getAsJsonArray("supplement");
13233      for (int i = 0; i < array.size(); i++) {
13234        res.getSupplement().add(parseNutritionOrderNutritionOrderSupplementComponent(array.get(i).getAsJsonObject(), res));
13235      }
13236    };
13237    if (json.has("enteralFormula"))
13238      res.setEnteralFormula(parseNutritionOrderNutritionOrderEnteralFormulaComponent(getJObject(json, "enteralFormula"), res));
13239  }
13240
13241  protected NutritionOrder.NutritionOrderOralDietComponent parseNutritionOrderNutritionOrderOralDietComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
13242    NutritionOrder.NutritionOrderOralDietComponent res = new NutritionOrder.NutritionOrderOralDietComponent();
13243    parseNutritionOrderNutritionOrderOralDietComponentProperties(json, owner, res);
13244    return res;
13245  }
13246
13247  protected void parseNutritionOrderNutritionOrderOralDietComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderOralDietComponent res) throws IOException, FHIRFormatError {
13248    parseBackboneProperties(json, res);
13249    if (json.has("type")) {
13250      JsonArray array = json.getAsJsonArray("type");
13251      for (int i = 0; i < array.size(); i++) {
13252        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13253      }
13254    };
13255    if (json.has("schedule")) {
13256      JsonArray array = json.getAsJsonArray("schedule");
13257      for (int i = 0; i < array.size(); i++) {
13258        res.getSchedule().add(parseTiming(array.get(i).getAsJsonObject()));
13259      }
13260    };
13261    if (json.has("nutrient")) {
13262      JsonArray array = json.getAsJsonArray("nutrient");
13263      for (int i = 0; i < array.size(); i++) {
13264        res.getNutrient().add(parseNutritionOrderNutritionOrderOralDietNutrientComponent(array.get(i).getAsJsonObject(), owner));
13265      }
13266    };
13267    if (json.has("texture")) {
13268      JsonArray array = json.getAsJsonArray("texture");
13269      for (int i = 0; i < array.size(); i++) {
13270        res.getTexture().add(parseNutritionOrderNutritionOrderOralDietTextureComponent(array.get(i).getAsJsonObject(), owner));
13271      }
13272    };
13273    if (json.has("fluidConsistencyType")) {
13274      JsonArray array = json.getAsJsonArray("fluidConsistencyType");
13275      for (int i = 0; i < array.size(); i++) {
13276        res.getFluidConsistencyType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13277      }
13278    };
13279    if (json.has("instruction"))
13280      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
13281    if (json.has("_instruction"))
13282      parseElementProperties(getJObject(json, "_instruction"), res.getInstructionElement());
13283  }
13284
13285  protected NutritionOrder.NutritionOrderOralDietNutrientComponent parseNutritionOrderNutritionOrderOralDietNutrientComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
13286    NutritionOrder.NutritionOrderOralDietNutrientComponent res = new NutritionOrder.NutritionOrderOralDietNutrientComponent();
13287    parseNutritionOrderNutritionOrderOralDietNutrientComponentProperties(json, owner, res);
13288    return res;
13289  }
13290
13291  protected void parseNutritionOrderNutritionOrderOralDietNutrientComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderOralDietNutrientComponent res) throws IOException, FHIRFormatError {
13292    parseBackboneProperties(json, res);
13293    if (json.has("modifier"))
13294      res.setModifier(parseCodeableConcept(getJObject(json, "modifier")));
13295    if (json.has("amount"))
13296      res.setAmount(parseSimpleQuantity(getJObject(json, "amount")));
13297  }
13298
13299  protected NutritionOrder.NutritionOrderOralDietTextureComponent parseNutritionOrderNutritionOrderOralDietTextureComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
13300    NutritionOrder.NutritionOrderOralDietTextureComponent res = new NutritionOrder.NutritionOrderOralDietTextureComponent();
13301    parseNutritionOrderNutritionOrderOralDietTextureComponentProperties(json, owner, res);
13302    return res;
13303  }
13304
13305  protected void parseNutritionOrderNutritionOrderOralDietTextureComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderOralDietTextureComponent res) throws IOException, FHIRFormatError {
13306    parseBackboneProperties(json, res);
13307    if (json.has("modifier"))
13308      res.setModifier(parseCodeableConcept(getJObject(json, "modifier")));
13309    if (json.has("foodType"))
13310      res.setFoodType(parseCodeableConcept(getJObject(json, "foodType")));
13311  }
13312
13313  protected NutritionOrder.NutritionOrderSupplementComponent parseNutritionOrderNutritionOrderSupplementComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
13314    NutritionOrder.NutritionOrderSupplementComponent res = new NutritionOrder.NutritionOrderSupplementComponent();
13315    parseNutritionOrderNutritionOrderSupplementComponentProperties(json, owner, res);
13316    return res;
13317  }
13318
13319  protected void parseNutritionOrderNutritionOrderSupplementComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderSupplementComponent res) throws IOException, FHIRFormatError {
13320    parseBackboneProperties(json, res);
13321    if (json.has("type"))
13322      res.setType(parseCodeableConcept(getJObject(json, "type")));
13323    if (json.has("productName"))
13324      res.setProductNameElement(parseString(json.get("productName").getAsString()));
13325    if (json.has("_productName"))
13326      parseElementProperties(getJObject(json, "_productName"), res.getProductNameElement());
13327    if (json.has("schedule")) {
13328      JsonArray array = json.getAsJsonArray("schedule");
13329      for (int i = 0; i < array.size(); i++) {
13330        res.getSchedule().add(parseTiming(array.get(i).getAsJsonObject()));
13331      }
13332    };
13333    if (json.has("quantity"))
13334      res.setQuantity(parseSimpleQuantity(getJObject(json, "quantity")));
13335    if (json.has("instruction"))
13336      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
13337    if (json.has("_instruction"))
13338      parseElementProperties(getJObject(json, "_instruction"), res.getInstructionElement());
13339  }
13340
13341  protected NutritionOrder.NutritionOrderEnteralFormulaComponent parseNutritionOrderNutritionOrderEnteralFormulaComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
13342    NutritionOrder.NutritionOrderEnteralFormulaComponent res = new NutritionOrder.NutritionOrderEnteralFormulaComponent();
13343    parseNutritionOrderNutritionOrderEnteralFormulaComponentProperties(json, owner, res);
13344    return res;
13345  }
13346
13347  protected void parseNutritionOrderNutritionOrderEnteralFormulaComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderEnteralFormulaComponent res) throws IOException, FHIRFormatError {
13348    parseBackboneProperties(json, res);
13349    if (json.has("baseFormulaType"))
13350      res.setBaseFormulaType(parseCodeableConcept(getJObject(json, "baseFormulaType")));
13351    if (json.has("baseFormulaProductName"))
13352      res.setBaseFormulaProductNameElement(parseString(json.get("baseFormulaProductName").getAsString()));
13353    if (json.has("_baseFormulaProductName"))
13354      parseElementProperties(getJObject(json, "_baseFormulaProductName"), res.getBaseFormulaProductNameElement());
13355    if (json.has("additiveType"))
13356      res.setAdditiveType(parseCodeableConcept(getJObject(json, "additiveType")));
13357    if (json.has("additiveProductName"))
13358      res.setAdditiveProductNameElement(parseString(json.get("additiveProductName").getAsString()));
13359    if (json.has("_additiveProductName"))
13360      parseElementProperties(getJObject(json, "_additiveProductName"), res.getAdditiveProductNameElement());
13361    if (json.has("caloricDensity"))
13362      res.setCaloricDensity(parseSimpleQuantity(getJObject(json, "caloricDensity")));
13363    if (json.has("routeofAdministration"))
13364      res.setRouteofAdministration(parseCodeableConcept(getJObject(json, "routeofAdministration")));
13365    if (json.has("administration")) {
13366      JsonArray array = json.getAsJsonArray("administration");
13367      for (int i = 0; i < array.size(); i++) {
13368        res.getAdministration().add(parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(array.get(i).getAsJsonObject(), owner));
13369      }
13370    };
13371    if (json.has("maxVolumeToDeliver"))
13372      res.setMaxVolumeToDeliver(parseSimpleQuantity(getJObject(json, "maxVolumeToDeliver")));
13373    if (json.has("administrationInstruction"))
13374      res.setAdministrationInstructionElement(parseString(json.get("administrationInstruction").getAsString()));
13375    if (json.has("_administrationInstruction"))
13376      parseElementProperties(getJObject(json, "_administrationInstruction"), res.getAdministrationInstructionElement());
13377  }
13378
13379  protected NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
13380    NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent res = new NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent();
13381    parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentProperties(json, owner, res);
13382    return res;
13383  }
13384
13385  protected void parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent res) throws IOException, FHIRFormatError {
13386    parseBackboneProperties(json, res);
13387    if (json.has("schedule"))
13388      res.setSchedule(parseTiming(getJObject(json, "schedule")));
13389    if (json.has("quantity"))
13390      res.setQuantity(parseSimpleQuantity(getJObject(json, "quantity")));
13391    Type rate = parseType("rate", json);
13392    if (rate != null)
13393      res.setRate(rate);
13394  }
13395
13396  protected Observation parseObservation(JsonObject json) throws IOException, FHIRFormatError {
13397    Observation res = new Observation();
13398    parseObservationProperties(json, res);
13399    return res;
13400  }
13401
13402  protected void parseObservationProperties(JsonObject json, Observation res) throws IOException, FHIRFormatError {
13403    parseDomainResourceProperties(json, res);
13404    if (json.has("identifier")) {
13405      JsonArray array = json.getAsJsonArray("identifier");
13406      for (int i = 0; i < array.size(); i++) {
13407        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13408      }
13409    };
13410    if (json.has("basedOn")) {
13411      JsonArray array = json.getAsJsonArray("basedOn");
13412      for (int i = 0; i < array.size(); i++) {
13413        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
13414      }
13415    };
13416    if (json.has("status"))
13417      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Observation.ObservationStatus.NULL, new Observation.ObservationStatusEnumFactory()));
13418    if (json.has("_status"))
13419      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
13420    if (json.has("category")) {
13421      JsonArray array = json.getAsJsonArray("category");
13422      for (int i = 0; i < array.size(); i++) {
13423        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13424      }
13425    };
13426    if (json.has("code"))
13427      res.setCode(parseCodeableConcept(getJObject(json, "code")));
13428    if (json.has("subject"))
13429      res.setSubject(parseReference(getJObject(json, "subject")));
13430    if (json.has("context"))
13431      res.setContext(parseReference(getJObject(json, "context")));
13432    Type effective = parseType("effective", json);
13433    if (effective != null)
13434      res.setEffective(effective);
13435    if (json.has("issued"))
13436      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
13437    if (json.has("_issued"))
13438      parseElementProperties(getJObject(json, "_issued"), res.getIssuedElement());
13439    if (json.has("performer")) {
13440      JsonArray array = json.getAsJsonArray("performer");
13441      for (int i = 0; i < array.size(); i++) {
13442        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
13443      }
13444    };
13445    Type value = parseType("value", json);
13446    if (value != null)
13447      res.setValue(value);
13448    if (json.has("dataAbsentReason"))
13449      res.setDataAbsentReason(parseCodeableConcept(getJObject(json, "dataAbsentReason")));
13450    if (json.has("interpretation"))
13451      res.setInterpretation(parseCodeableConcept(getJObject(json, "interpretation")));
13452    if (json.has("comment"))
13453      res.setCommentElement(parseString(json.get("comment").getAsString()));
13454    if (json.has("_comment"))
13455      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
13456    if (json.has("bodySite"))
13457      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
13458    if (json.has("method"))
13459      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
13460    if (json.has("specimen"))
13461      res.setSpecimen(parseReference(getJObject(json, "specimen")));
13462    if (json.has("device"))
13463      res.setDevice(parseReference(getJObject(json, "device")));
13464    if (json.has("referenceRange")) {
13465      JsonArray array = json.getAsJsonArray("referenceRange");
13466      for (int i = 0; i < array.size(); i++) {
13467        res.getReferenceRange().add(parseObservationObservationReferenceRangeComponent(array.get(i).getAsJsonObject(), res));
13468      }
13469    };
13470    if (json.has("related")) {
13471      JsonArray array = json.getAsJsonArray("related");
13472      for (int i = 0; i < array.size(); i++) {
13473        res.getRelated().add(parseObservationObservationRelatedComponent(array.get(i).getAsJsonObject(), res));
13474      }
13475    };
13476    if (json.has("component")) {
13477      JsonArray array = json.getAsJsonArray("component");
13478      for (int i = 0; i < array.size(); i++) {
13479        res.getComponent().add(parseObservationObservationComponentComponent(array.get(i).getAsJsonObject(), res));
13480      }
13481    };
13482  }
13483
13484  protected Observation.ObservationReferenceRangeComponent parseObservationObservationReferenceRangeComponent(JsonObject json, Observation owner) throws IOException, FHIRFormatError {
13485    Observation.ObservationReferenceRangeComponent res = new Observation.ObservationReferenceRangeComponent();
13486    parseObservationObservationReferenceRangeComponentProperties(json, owner, res);
13487    return res;
13488  }
13489
13490  protected void parseObservationObservationReferenceRangeComponentProperties(JsonObject json, Observation owner, Observation.ObservationReferenceRangeComponent res) throws IOException, FHIRFormatError {
13491    parseBackboneProperties(json, res);
13492    if (json.has("low"))
13493      res.setLow(parseSimpleQuantity(getJObject(json, "low")));
13494    if (json.has("high"))
13495      res.setHigh(parseSimpleQuantity(getJObject(json, "high")));
13496    if (json.has("type"))
13497      res.setType(parseCodeableConcept(getJObject(json, "type")));
13498    if (json.has("appliesTo")) {
13499      JsonArray array = json.getAsJsonArray("appliesTo");
13500      for (int i = 0; i < array.size(); i++) {
13501        res.getAppliesTo().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13502      }
13503    };
13504    if (json.has("age"))
13505      res.setAge(parseRange(getJObject(json, "age")));
13506    if (json.has("text"))
13507      res.setTextElement(parseString(json.get("text").getAsString()));
13508    if (json.has("_text"))
13509      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
13510  }
13511
13512  protected Observation.ObservationRelatedComponent parseObservationObservationRelatedComponent(JsonObject json, Observation owner) throws IOException, FHIRFormatError {
13513    Observation.ObservationRelatedComponent res = new Observation.ObservationRelatedComponent();
13514    parseObservationObservationRelatedComponentProperties(json, owner, res);
13515    return res;
13516  }
13517
13518  protected void parseObservationObservationRelatedComponentProperties(JsonObject json, Observation owner, Observation.ObservationRelatedComponent res) throws IOException, FHIRFormatError {
13519    parseBackboneProperties(json, res);
13520    if (json.has("type"))
13521      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Observation.ObservationRelationshipType.NULL, new Observation.ObservationRelationshipTypeEnumFactory()));
13522    if (json.has("_type"))
13523      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
13524    if (json.has("target"))
13525      res.setTarget(parseReference(getJObject(json, "target")));
13526  }
13527
13528  protected Observation.ObservationComponentComponent parseObservationObservationComponentComponent(JsonObject json, Observation owner) throws IOException, FHIRFormatError {
13529    Observation.ObservationComponentComponent res = new Observation.ObservationComponentComponent();
13530    parseObservationObservationComponentComponentProperties(json, owner, res);
13531    return res;
13532  }
13533
13534  protected void parseObservationObservationComponentComponentProperties(JsonObject json, Observation owner, Observation.ObservationComponentComponent res) throws IOException, FHIRFormatError {
13535    parseBackboneProperties(json, res);
13536    if (json.has("code"))
13537      res.setCode(parseCodeableConcept(getJObject(json, "code")));
13538    Type value = parseType("value", json);
13539    if (value != null)
13540      res.setValue(value);
13541    if (json.has("dataAbsentReason"))
13542      res.setDataAbsentReason(parseCodeableConcept(getJObject(json, "dataAbsentReason")));
13543    if (json.has("interpretation"))
13544      res.setInterpretation(parseCodeableConcept(getJObject(json, "interpretation")));
13545    if (json.has("referenceRange")) {
13546      JsonArray array = json.getAsJsonArray("referenceRange");
13547      for (int i = 0; i < array.size(); i++) {
13548        res.getReferenceRange().add(parseObservationObservationReferenceRangeComponent(array.get(i).getAsJsonObject(), owner));
13549      }
13550    };
13551  }
13552
13553  protected OperationDefinition parseOperationDefinition(JsonObject json) throws IOException, FHIRFormatError {
13554    OperationDefinition res = new OperationDefinition();
13555    parseOperationDefinitionProperties(json, res);
13556    return res;
13557  }
13558
13559  protected void parseOperationDefinitionProperties(JsonObject json, OperationDefinition res) throws IOException, FHIRFormatError {
13560    parseDomainResourceProperties(json, res);
13561    if (json.has("url"))
13562      res.setUrlElement(parseUri(json.get("url").getAsString()));
13563    if (json.has("_url"))
13564      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
13565    if (json.has("version"))
13566      res.setVersionElement(parseString(json.get("version").getAsString()));
13567    if (json.has("_version"))
13568      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
13569    if (json.has("name"))
13570      res.setNameElement(parseString(json.get("name").getAsString()));
13571    if (json.has("_name"))
13572      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
13573    if (json.has("status"))
13574      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
13575    if (json.has("_status"))
13576      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
13577    if (json.has("kind"))
13578      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), OperationDefinition.OperationKind.NULL, new OperationDefinition.OperationKindEnumFactory()));
13579    if (json.has("_kind"))
13580      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
13581    if (json.has("experimental"))
13582      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
13583    if (json.has("_experimental"))
13584      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
13585    if (json.has("date"))
13586      res.setDateElement(parseDateTime(json.get("date").getAsString()));
13587    if (json.has("_date"))
13588      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
13589    if (json.has("publisher"))
13590      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
13591    if (json.has("_publisher"))
13592      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
13593    if (json.has("contact")) {
13594      JsonArray array = json.getAsJsonArray("contact");
13595      for (int i = 0; i < array.size(); i++) {
13596        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
13597      }
13598    };
13599    if (json.has("description"))
13600      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
13601    if (json.has("_description"))
13602      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
13603    if (json.has("useContext")) {
13604      JsonArray array = json.getAsJsonArray("useContext");
13605      for (int i = 0; i < array.size(); i++) {
13606        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
13607      }
13608    };
13609    if (json.has("jurisdiction")) {
13610      JsonArray array = json.getAsJsonArray("jurisdiction");
13611      for (int i = 0; i < array.size(); i++) {
13612        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13613      }
13614    };
13615    if (json.has("purpose"))
13616      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
13617    if (json.has("_purpose"))
13618      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
13619    if (json.has("idempotent"))
13620      res.setIdempotentElement(parseBoolean(json.get("idempotent").getAsBoolean()));
13621    if (json.has("_idempotent"))
13622      parseElementProperties(getJObject(json, "_idempotent"), res.getIdempotentElement());
13623    if (json.has("code"))
13624      res.setCodeElement(parseCode(json.get("code").getAsString()));
13625    if (json.has("_code"))
13626      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
13627    if (json.has("comment"))
13628      res.setCommentElement(parseString(json.get("comment").getAsString()));
13629    if (json.has("_comment"))
13630      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
13631    if (json.has("base"))
13632      res.setBase(parseReference(getJObject(json, "base")));
13633    if (json.has("resource")) {
13634      JsonArray array = json.getAsJsonArray("resource");
13635      for (int i = 0; i < array.size(); i++) {
13636        if (array.get(i).isJsonNull()) {
13637          res.getResource().add(new CodeType());
13638        } else {
13639          res.getResource().add(parseCode(array.get(i).getAsString()));
13640        }
13641      }
13642    };
13643    if (json.has("_resource")) {
13644      JsonArray array = json.getAsJsonArray("_resource");
13645      for (int i = 0; i < array.size(); i++) {
13646        if (i == res.getResource().size())
13647          res.getResource().add(parseCode(null));
13648        if (array.get(i) instanceof JsonObject) 
13649          parseElementProperties(array.get(i).getAsJsonObject(), res.getResource().get(i));
13650      }
13651    };
13652    if (json.has("system"))
13653      res.setSystemElement(parseBoolean(json.get("system").getAsBoolean()));
13654    if (json.has("_system"))
13655      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
13656    if (json.has("type"))
13657      res.setTypeElement(parseBoolean(json.get("type").getAsBoolean()));
13658    if (json.has("_type"))
13659      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
13660    if (json.has("instance"))
13661      res.setInstanceElement(parseBoolean(json.get("instance").getAsBoolean()));
13662    if (json.has("_instance"))
13663      parseElementProperties(getJObject(json, "_instance"), res.getInstanceElement());
13664    if (json.has("parameter")) {
13665      JsonArray array = json.getAsJsonArray("parameter");
13666      for (int i = 0; i < array.size(); i++) {
13667        res.getParameter().add(parseOperationDefinitionOperationDefinitionParameterComponent(array.get(i).getAsJsonObject(), res));
13668      }
13669    };
13670    if (json.has("overload")) {
13671      JsonArray array = json.getAsJsonArray("overload");
13672      for (int i = 0; i < array.size(); i++) {
13673        res.getOverload().add(parseOperationDefinitionOperationDefinitionOverloadComponent(array.get(i).getAsJsonObject(), res));
13674      }
13675    };
13676  }
13677
13678  protected OperationDefinition.OperationDefinitionParameterComponent parseOperationDefinitionOperationDefinitionParameterComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
13679    OperationDefinition.OperationDefinitionParameterComponent res = new OperationDefinition.OperationDefinitionParameterComponent();
13680    parseOperationDefinitionOperationDefinitionParameterComponentProperties(json, owner, res);
13681    return res;
13682  }
13683
13684  protected void parseOperationDefinitionOperationDefinitionParameterComponentProperties(JsonObject json, OperationDefinition owner, OperationDefinition.OperationDefinitionParameterComponent res) throws IOException, FHIRFormatError {
13685    parseBackboneProperties(json, res);
13686    if (json.has("name"))
13687      res.setNameElement(parseCode(json.get("name").getAsString()));
13688    if (json.has("_name"))
13689      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
13690    if (json.has("use"))
13691      res.setUseElement(parseEnumeration(json.get("use").getAsString(), OperationDefinition.OperationParameterUse.NULL, new OperationDefinition.OperationParameterUseEnumFactory()));
13692    if (json.has("_use"))
13693      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
13694    if (json.has("min"))
13695      res.setMinElement(parseInteger(json.get("min").getAsLong()));
13696    if (json.has("_min"))
13697      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
13698    if (json.has("max"))
13699      res.setMaxElement(parseString(json.get("max").getAsString()));
13700    if (json.has("_max"))
13701      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
13702    if (json.has("documentation"))
13703      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
13704    if (json.has("_documentation"))
13705      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
13706    if (json.has("type"))
13707      res.setTypeElement(parseCode(json.get("type").getAsString()));
13708    if (json.has("_type"))
13709      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
13710    if (json.has("searchType"))
13711      res.setSearchTypeElement(parseEnumeration(json.get("searchType").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
13712    if (json.has("_searchType"))
13713      parseElementProperties(getJObject(json, "_searchType"), res.getSearchTypeElement());
13714    if (json.has("profile"))
13715      res.setProfile(parseReference(getJObject(json, "profile")));
13716    if (json.has("binding"))
13717      res.setBinding(parseOperationDefinitionOperationDefinitionParameterBindingComponent(getJObject(json, "binding"), owner));
13718    if (json.has("part")) {
13719      JsonArray array = json.getAsJsonArray("part");
13720      for (int i = 0; i < array.size(); i++) {
13721        res.getPart().add(parseOperationDefinitionOperationDefinitionParameterComponent(array.get(i).getAsJsonObject(), owner));
13722      }
13723    };
13724  }
13725
13726  protected OperationDefinition.OperationDefinitionParameterBindingComponent parseOperationDefinitionOperationDefinitionParameterBindingComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
13727    OperationDefinition.OperationDefinitionParameterBindingComponent res = new OperationDefinition.OperationDefinitionParameterBindingComponent();
13728    parseOperationDefinitionOperationDefinitionParameterBindingComponentProperties(json, owner, res);
13729    return res;
13730  }
13731
13732  protected void parseOperationDefinitionOperationDefinitionParameterBindingComponentProperties(JsonObject json, OperationDefinition owner, OperationDefinition.OperationDefinitionParameterBindingComponent res) throws IOException, FHIRFormatError {
13733    parseBackboneProperties(json, res);
13734    if (json.has("strength"))
13735      res.setStrengthElement(parseEnumeration(json.get("strength").getAsString(), Enumerations.BindingStrength.NULL, new Enumerations.BindingStrengthEnumFactory()));
13736    if (json.has("_strength"))
13737      parseElementProperties(getJObject(json, "_strength"), res.getStrengthElement());
13738    Type valueSet = parseType("valueSet", json);
13739    if (valueSet != null)
13740      res.setValueSet(valueSet);
13741  }
13742
13743  protected OperationDefinition.OperationDefinitionOverloadComponent parseOperationDefinitionOperationDefinitionOverloadComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
13744    OperationDefinition.OperationDefinitionOverloadComponent res = new OperationDefinition.OperationDefinitionOverloadComponent();
13745    parseOperationDefinitionOperationDefinitionOverloadComponentProperties(json, owner, res);
13746    return res;
13747  }
13748
13749  protected void parseOperationDefinitionOperationDefinitionOverloadComponentProperties(JsonObject json, OperationDefinition owner, OperationDefinition.OperationDefinitionOverloadComponent res) throws IOException, FHIRFormatError {
13750    parseBackboneProperties(json, res);
13751    if (json.has("parameterName")) {
13752      JsonArray array = json.getAsJsonArray("parameterName");
13753      for (int i = 0; i < array.size(); i++) {
13754        if (array.get(i).isJsonNull()) {
13755          res.getParameterName().add(new StringType());
13756        } else {
13757          res.getParameterName().add(parseString(array.get(i).getAsString()));
13758        }
13759      }
13760    };
13761    if (json.has("_parameterName")) {
13762      JsonArray array = json.getAsJsonArray("_parameterName");
13763      for (int i = 0; i < array.size(); i++) {
13764        if (i == res.getParameterName().size())
13765          res.getParameterName().add(parseString(null));
13766        if (array.get(i) instanceof JsonObject) 
13767          parseElementProperties(array.get(i).getAsJsonObject(), res.getParameterName().get(i));
13768      }
13769    };
13770    if (json.has("comment"))
13771      res.setCommentElement(parseString(json.get("comment").getAsString()));
13772    if (json.has("_comment"))
13773      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
13774  }
13775
13776  protected OperationOutcome parseOperationOutcome(JsonObject json) throws IOException, FHIRFormatError {
13777    OperationOutcome res = new OperationOutcome();
13778    parseOperationOutcomeProperties(json, res);
13779    return res;
13780  }
13781
13782  protected void parseOperationOutcomeProperties(JsonObject json, OperationOutcome res) throws IOException, FHIRFormatError {
13783    parseDomainResourceProperties(json, res);
13784    if (json.has("issue")) {
13785      JsonArray array = json.getAsJsonArray("issue");
13786      for (int i = 0; i < array.size(); i++) {
13787        res.getIssue().add(parseOperationOutcomeOperationOutcomeIssueComponent(array.get(i).getAsJsonObject(), res));
13788      }
13789    };
13790  }
13791
13792  protected OperationOutcome.OperationOutcomeIssueComponent parseOperationOutcomeOperationOutcomeIssueComponent(JsonObject json, OperationOutcome owner) throws IOException, FHIRFormatError {
13793    OperationOutcome.OperationOutcomeIssueComponent res = new OperationOutcome.OperationOutcomeIssueComponent();
13794    parseOperationOutcomeOperationOutcomeIssueComponentProperties(json, owner, res);
13795    return res;
13796  }
13797
13798  protected void parseOperationOutcomeOperationOutcomeIssueComponentProperties(JsonObject json, OperationOutcome owner, OperationOutcome.OperationOutcomeIssueComponent res) throws IOException, FHIRFormatError {
13799    parseBackboneProperties(json, res);
13800    if (json.has("severity"))
13801      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), OperationOutcome.IssueSeverity.NULL, new OperationOutcome.IssueSeverityEnumFactory()));
13802    if (json.has("_severity"))
13803      parseElementProperties(getJObject(json, "_severity"), res.getSeverityElement());
13804    if (json.has("code"))
13805      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), OperationOutcome.IssueType.NULL, new OperationOutcome.IssueTypeEnumFactory()));
13806    if (json.has("_code"))
13807      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
13808    if (json.has("details"))
13809      res.setDetails(parseCodeableConcept(getJObject(json, "details")));
13810    if (json.has("diagnostics"))
13811      res.setDiagnosticsElement(parseString(json.get("diagnostics").getAsString()));
13812    if (json.has("_diagnostics"))
13813      parseElementProperties(getJObject(json, "_diagnostics"), res.getDiagnosticsElement());
13814    if (json.has("location")) {
13815      JsonArray array = json.getAsJsonArray("location");
13816      for (int i = 0; i < array.size(); i++) {
13817        if (array.get(i).isJsonNull()) {
13818          res.getLocation().add(new StringType());
13819        } else {
13820          res.getLocation().add(parseString(array.get(i).getAsString()));
13821        }
13822      }
13823    };
13824    if (json.has("_location")) {
13825      JsonArray array = json.getAsJsonArray("_location");
13826      for (int i = 0; i < array.size(); i++) {
13827        if (i == res.getLocation().size())
13828          res.getLocation().add(parseString(null));
13829        if (array.get(i) instanceof JsonObject) 
13830          parseElementProperties(array.get(i).getAsJsonObject(), res.getLocation().get(i));
13831      }
13832    };
13833    if (json.has("expression")) {
13834      JsonArray array = json.getAsJsonArray("expression");
13835      for (int i = 0; i < array.size(); i++) {
13836        if (array.get(i).isJsonNull()) {
13837          res.getExpression().add(new StringType());
13838        } else {
13839          res.getExpression().add(parseString(array.get(i).getAsString()));
13840        }
13841      }
13842    };
13843    if (json.has("_expression")) {
13844      JsonArray array = json.getAsJsonArray("_expression");
13845      for (int i = 0; i < array.size(); i++) {
13846        if (i == res.getExpression().size())
13847          res.getExpression().add(parseString(null));
13848        if (array.get(i) instanceof JsonObject) 
13849          parseElementProperties(array.get(i).getAsJsonObject(), res.getExpression().get(i));
13850      }
13851    };
13852  }
13853
13854  protected Organization parseOrganization(JsonObject json) throws IOException, FHIRFormatError {
13855    Organization res = new Organization();
13856    parseOrganizationProperties(json, res);
13857    return res;
13858  }
13859
13860  protected void parseOrganizationProperties(JsonObject json, Organization res) throws IOException, FHIRFormatError {
13861    parseDomainResourceProperties(json, res);
13862    if (json.has("identifier")) {
13863      JsonArray array = json.getAsJsonArray("identifier");
13864      for (int i = 0; i < array.size(); i++) {
13865        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13866      }
13867    };
13868    if (json.has("active"))
13869      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
13870    if (json.has("_active"))
13871      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
13872    if (json.has("type")) {
13873      JsonArray array = json.getAsJsonArray("type");
13874      for (int i = 0; i < array.size(); i++) {
13875        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13876      }
13877    };
13878    if (json.has("name"))
13879      res.setNameElement(parseString(json.get("name").getAsString()));
13880    if (json.has("_name"))
13881      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
13882    if (json.has("alias")) {
13883      JsonArray array = json.getAsJsonArray("alias");
13884      for (int i = 0; i < array.size(); i++) {
13885        if (array.get(i).isJsonNull()) {
13886          res.getAlias().add(new StringType());
13887        } else {
13888          res.getAlias().add(parseString(array.get(i).getAsString()));
13889        }
13890      }
13891    };
13892    if (json.has("_alias")) {
13893      JsonArray array = json.getAsJsonArray("_alias");
13894      for (int i = 0; i < array.size(); i++) {
13895        if (i == res.getAlias().size())
13896          res.getAlias().add(parseString(null));
13897        if (array.get(i) instanceof JsonObject) 
13898          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
13899      }
13900    };
13901    if (json.has("telecom")) {
13902      JsonArray array = json.getAsJsonArray("telecom");
13903      for (int i = 0; i < array.size(); i++) {
13904        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
13905      }
13906    };
13907    if (json.has("address")) {
13908      JsonArray array = json.getAsJsonArray("address");
13909      for (int i = 0; i < array.size(); i++) {
13910        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
13911      }
13912    };
13913    if (json.has("partOf"))
13914      res.setPartOf(parseReference(getJObject(json, "partOf")));
13915    if (json.has("contact")) {
13916      JsonArray array = json.getAsJsonArray("contact");
13917      for (int i = 0; i < array.size(); i++) {
13918        res.getContact().add(parseOrganizationOrganizationContactComponent(array.get(i).getAsJsonObject(), res));
13919      }
13920    };
13921    if (json.has("endpoint")) {
13922      JsonArray array = json.getAsJsonArray("endpoint");
13923      for (int i = 0; i < array.size(); i++) {
13924        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
13925      }
13926    };
13927  }
13928
13929  protected Organization.OrganizationContactComponent parseOrganizationOrganizationContactComponent(JsonObject json, Organization owner) throws IOException, FHIRFormatError {
13930    Organization.OrganizationContactComponent res = new Organization.OrganizationContactComponent();
13931    parseOrganizationOrganizationContactComponentProperties(json, owner, res);
13932    return res;
13933  }
13934
13935  protected void parseOrganizationOrganizationContactComponentProperties(JsonObject json, Organization owner, Organization.OrganizationContactComponent res) throws IOException, FHIRFormatError {
13936    parseBackboneProperties(json, res);
13937    if (json.has("purpose"))
13938      res.setPurpose(parseCodeableConcept(getJObject(json, "purpose")));
13939    if (json.has("name"))
13940      res.setName(parseHumanName(getJObject(json, "name")));
13941    if (json.has("telecom")) {
13942      JsonArray array = json.getAsJsonArray("telecom");
13943      for (int i = 0; i < array.size(); i++) {
13944        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
13945      }
13946    };
13947    if (json.has("address"))
13948      res.setAddress(parseAddress(getJObject(json, "address")));
13949  }
13950
13951  protected Patient parsePatient(JsonObject json) throws IOException, FHIRFormatError {
13952    Patient res = new Patient();
13953    parsePatientProperties(json, res);
13954    return res;
13955  }
13956
13957  protected void parsePatientProperties(JsonObject json, Patient res) throws IOException, FHIRFormatError {
13958    parseDomainResourceProperties(json, res);
13959    if (json.has("identifier")) {
13960      JsonArray array = json.getAsJsonArray("identifier");
13961      for (int i = 0; i < array.size(); i++) {
13962        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13963      }
13964    };
13965    if (json.has("active"))
13966      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
13967    if (json.has("_active"))
13968      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
13969    if (json.has("name")) {
13970      JsonArray array = json.getAsJsonArray("name");
13971      for (int i = 0; i < array.size(); i++) {
13972        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
13973      }
13974    };
13975    if (json.has("telecom")) {
13976      JsonArray array = json.getAsJsonArray("telecom");
13977      for (int i = 0; i < array.size(); i++) {
13978        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
13979      }
13980    };
13981    if (json.has("gender"))
13982      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
13983    if (json.has("_gender"))
13984      parseElementProperties(getJObject(json, "_gender"), res.getGenderElement());
13985    if (json.has("birthDate"))
13986      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
13987    if (json.has("_birthDate"))
13988      parseElementProperties(getJObject(json, "_birthDate"), res.getBirthDateElement());
13989    Type deceased = parseType("deceased", json);
13990    if (deceased != null)
13991      res.setDeceased(deceased);
13992    if (json.has("address")) {
13993      JsonArray array = json.getAsJsonArray("address");
13994      for (int i = 0; i < array.size(); i++) {
13995        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
13996      }
13997    };
13998    if (json.has("maritalStatus"))
13999      res.setMaritalStatus(parseCodeableConcept(getJObject(json, "maritalStatus")));
14000    Type multipleBirth = parseType("multipleBirth", json);
14001    if (multipleBirth != null)
14002      res.setMultipleBirth(multipleBirth);
14003    if (json.has("photo")) {
14004      JsonArray array = json.getAsJsonArray("photo");
14005      for (int i = 0; i < array.size(); i++) {
14006        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
14007      }
14008    };
14009    if (json.has("contact")) {
14010      JsonArray array = json.getAsJsonArray("contact");
14011      for (int i = 0; i < array.size(); i++) {
14012        res.getContact().add(parsePatientContactComponent(array.get(i).getAsJsonObject(), res));
14013      }
14014    };
14015    if (json.has("animal"))
14016      res.setAnimal(parsePatientAnimalComponent(getJObject(json, "animal"), res));
14017    if (json.has("communication")) {
14018      JsonArray array = json.getAsJsonArray("communication");
14019      for (int i = 0; i < array.size(); i++) {
14020        res.getCommunication().add(parsePatientPatientCommunicationComponent(array.get(i).getAsJsonObject(), res));
14021      }
14022    };
14023    if (json.has("generalPractitioner")) {
14024      JsonArray array = json.getAsJsonArray("generalPractitioner");
14025      for (int i = 0; i < array.size(); i++) {
14026        res.getGeneralPractitioner().add(parseReference(array.get(i).getAsJsonObject()));
14027      }
14028    };
14029    if (json.has("managingOrganization"))
14030      res.setManagingOrganization(parseReference(getJObject(json, "managingOrganization")));
14031    if (json.has("link")) {
14032      JsonArray array = json.getAsJsonArray("link");
14033      for (int i = 0; i < array.size(); i++) {
14034        res.getLink().add(parsePatientPatientLinkComponent(array.get(i).getAsJsonObject(), res));
14035      }
14036    };
14037  }
14038
14039  protected Patient.ContactComponent parsePatientContactComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
14040    Patient.ContactComponent res = new Patient.ContactComponent();
14041    parsePatientContactComponentProperties(json, owner, res);
14042    return res;
14043  }
14044
14045  protected void parsePatientContactComponentProperties(JsonObject json, Patient owner, Patient.ContactComponent res) throws IOException, FHIRFormatError {
14046    parseBackboneProperties(json, res);
14047    if (json.has("relationship")) {
14048      JsonArray array = json.getAsJsonArray("relationship");
14049      for (int i = 0; i < array.size(); i++) {
14050        res.getRelationship().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14051      }
14052    };
14053    if (json.has("name"))
14054      res.setName(parseHumanName(getJObject(json, "name")));
14055    if (json.has("telecom")) {
14056      JsonArray array = json.getAsJsonArray("telecom");
14057      for (int i = 0; i < array.size(); i++) {
14058        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
14059      }
14060    };
14061    if (json.has("address"))
14062      res.setAddress(parseAddress(getJObject(json, "address")));
14063    if (json.has("gender"))
14064      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
14065    if (json.has("_gender"))
14066      parseElementProperties(getJObject(json, "_gender"), res.getGenderElement());
14067    if (json.has("organization"))
14068      res.setOrganization(parseReference(getJObject(json, "organization")));
14069    if (json.has("period"))
14070      res.setPeriod(parsePeriod(getJObject(json, "period")));
14071  }
14072
14073  protected Patient.AnimalComponent parsePatientAnimalComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
14074    Patient.AnimalComponent res = new Patient.AnimalComponent();
14075    parsePatientAnimalComponentProperties(json, owner, res);
14076    return res;
14077  }
14078
14079  protected void parsePatientAnimalComponentProperties(JsonObject json, Patient owner, Patient.AnimalComponent res) throws IOException, FHIRFormatError {
14080    parseBackboneProperties(json, res);
14081    if (json.has("species"))
14082      res.setSpecies(parseCodeableConcept(getJObject(json, "species")));
14083    if (json.has("breed"))
14084      res.setBreed(parseCodeableConcept(getJObject(json, "breed")));
14085    if (json.has("genderStatus"))
14086      res.setGenderStatus(parseCodeableConcept(getJObject(json, "genderStatus")));
14087  }
14088
14089  protected Patient.PatientCommunicationComponent parsePatientPatientCommunicationComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
14090    Patient.PatientCommunicationComponent res = new Patient.PatientCommunicationComponent();
14091    parsePatientPatientCommunicationComponentProperties(json, owner, res);
14092    return res;
14093  }
14094
14095  protected void parsePatientPatientCommunicationComponentProperties(JsonObject json, Patient owner, Patient.PatientCommunicationComponent res) throws IOException, FHIRFormatError {
14096    parseBackboneProperties(json, res);
14097    if (json.has("language"))
14098      res.setLanguage(parseCodeableConcept(getJObject(json, "language")));
14099    if (json.has("preferred"))
14100      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
14101    if (json.has("_preferred"))
14102      parseElementProperties(getJObject(json, "_preferred"), res.getPreferredElement());
14103  }
14104
14105  protected Patient.PatientLinkComponent parsePatientPatientLinkComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
14106    Patient.PatientLinkComponent res = new Patient.PatientLinkComponent();
14107    parsePatientPatientLinkComponentProperties(json, owner, res);
14108    return res;
14109  }
14110
14111  protected void parsePatientPatientLinkComponentProperties(JsonObject json, Patient owner, Patient.PatientLinkComponent res) throws IOException, FHIRFormatError {
14112    parseBackboneProperties(json, res);
14113    if (json.has("other"))
14114      res.setOther(parseReference(getJObject(json, "other")));
14115    if (json.has("type"))
14116      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Patient.LinkType.NULL, new Patient.LinkTypeEnumFactory()));
14117    if (json.has("_type"))
14118      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
14119  }
14120
14121  protected PaymentNotice parsePaymentNotice(JsonObject json) throws IOException, FHIRFormatError {
14122    PaymentNotice res = new PaymentNotice();
14123    parsePaymentNoticeProperties(json, res);
14124    return res;
14125  }
14126
14127  protected void parsePaymentNoticeProperties(JsonObject json, PaymentNotice res) throws IOException, FHIRFormatError {
14128    parseDomainResourceProperties(json, res);
14129    if (json.has("identifier")) {
14130      JsonArray array = json.getAsJsonArray("identifier");
14131      for (int i = 0; i < array.size(); i++) {
14132        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14133      }
14134    };
14135    if (json.has("status"))
14136      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), PaymentNotice.PaymentNoticeStatus.NULL, new PaymentNotice.PaymentNoticeStatusEnumFactory()));
14137    if (json.has("_status"))
14138      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
14139    if (json.has("request"))
14140      res.setRequest(parseReference(getJObject(json, "request")));
14141    if (json.has("response"))
14142      res.setResponse(parseReference(getJObject(json, "response")));
14143    if (json.has("statusDate"))
14144      res.setStatusDateElement(parseDate(json.get("statusDate").getAsString()));
14145    if (json.has("_statusDate"))
14146      parseElementProperties(getJObject(json, "_statusDate"), res.getStatusDateElement());
14147    if (json.has("created"))
14148      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
14149    if (json.has("_created"))
14150      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
14151    if (json.has("target"))
14152      res.setTarget(parseReference(getJObject(json, "target")));
14153    if (json.has("provider"))
14154      res.setProvider(parseReference(getJObject(json, "provider")));
14155    if (json.has("organization"))
14156      res.setOrganization(parseReference(getJObject(json, "organization")));
14157    if (json.has("paymentStatus"))
14158      res.setPaymentStatus(parseCodeableConcept(getJObject(json, "paymentStatus")));
14159  }
14160
14161  protected PaymentReconciliation parsePaymentReconciliation(JsonObject json) throws IOException, FHIRFormatError {
14162    PaymentReconciliation res = new PaymentReconciliation();
14163    parsePaymentReconciliationProperties(json, res);
14164    return res;
14165  }
14166
14167  protected void parsePaymentReconciliationProperties(JsonObject json, PaymentReconciliation res) throws IOException, FHIRFormatError {
14168    parseDomainResourceProperties(json, res);
14169    if (json.has("identifier")) {
14170      JsonArray array = json.getAsJsonArray("identifier");
14171      for (int i = 0; i < array.size(); i++) {
14172        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14173      }
14174    };
14175    if (json.has("status"))
14176      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), PaymentReconciliation.PaymentReconciliationStatus.NULL, new PaymentReconciliation.PaymentReconciliationStatusEnumFactory()));
14177    if (json.has("_status"))
14178      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
14179    if (json.has("period"))
14180      res.setPeriod(parsePeriod(getJObject(json, "period")));
14181    if (json.has("created"))
14182      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
14183    if (json.has("_created"))
14184      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
14185    if (json.has("organization"))
14186      res.setOrganization(parseReference(getJObject(json, "organization")));
14187    if (json.has("request"))
14188      res.setRequest(parseReference(getJObject(json, "request")));
14189    if (json.has("outcome"))
14190      res.setOutcome(parseCodeableConcept(getJObject(json, "outcome")));
14191    if (json.has("disposition"))
14192      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
14193    if (json.has("_disposition"))
14194      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
14195    if (json.has("requestProvider"))
14196      res.setRequestProvider(parseReference(getJObject(json, "requestProvider")));
14197    if (json.has("requestOrganization"))
14198      res.setRequestOrganization(parseReference(getJObject(json, "requestOrganization")));
14199    if (json.has("detail")) {
14200      JsonArray array = json.getAsJsonArray("detail");
14201      for (int i = 0; i < array.size(); i++) {
14202        res.getDetail().add(parsePaymentReconciliationDetailsComponent(array.get(i).getAsJsonObject(), res));
14203      }
14204    };
14205    if (json.has("form"))
14206      res.setForm(parseCodeableConcept(getJObject(json, "form")));
14207    if (json.has("total"))
14208      res.setTotal(parseMoney(getJObject(json, "total")));
14209    if (json.has("processNote")) {
14210      JsonArray array = json.getAsJsonArray("processNote");
14211      for (int i = 0; i < array.size(); i++) {
14212        res.getProcessNote().add(parsePaymentReconciliationNotesComponent(array.get(i).getAsJsonObject(), res));
14213      }
14214    };
14215  }
14216
14217  protected PaymentReconciliation.DetailsComponent parsePaymentReconciliationDetailsComponent(JsonObject json, PaymentReconciliation owner) throws IOException, FHIRFormatError {
14218    PaymentReconciliation.DetailsComponent res = new PaymentReconciliation.DetailsComponent();
14219    parsePaymentReconciliationDetailsComponentProperties(json, owner, res);
14220    return res;
14221  }
14222
14223  protected void parsePaymentReconciliationDetailsComponentProperties(JsonObject json, PaymentReconciliation owner, PaymentReconciliation.DetailsComponent res) throws IOException, FHIRFormatError {
14224    parseBackboneProperties(json, res);
14225    if (json.has("type"))
14226      res.setType(parseCodeableConcept(getJObject(json, "type")));
14227    if (json.has("request"))
14228      res.setRequest(parseReference(getJObject(json, "request")));
14229    if (json.has("response"))
14230      res.setResponse(parseReference(getJObject(json, "response")));
14231    if (json.has("submitter"))
14232      res.setSubmitter(parseReference(getJObject(json, "submitter")));
14233    if (json.has("payee"))
14234      res.setPayee(parseReference(getJObject(json, "payee")));
14235    if (json.has("date"))
14236      res.setDateElement(parseDate(json.get("date").getAsString()));
14237    if (json.has("_date"))
14238      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
14239    if (json.has("amount"))
14240      res.setAmount(parseMoney(getJObject(json, "amount")));
14241  }
14242
14243  protected PaymentReconciliation.NotesComponent parsePaymentReconciliationNotesComponent(JsonObject json, PaymentReconciliation owner) throws IOException, FHIRFormatError {
14244    PaymentReconciliation.NotesComponent res = new PaymentReconciliation.NotesComponent();
14245    parsePaymentReconciliationNotesComponentProperties(json, owner, res);
14246    return res;
14247  }
14248
14249  protected void parsePaymentReconciliationNotesComponentProperties(JsonObject json, PaymentReconciliation owner, PaymentReconciliation.NotesComponent res) throws IOException, FHIRFormatError {
14250    parseBackboneProperties(json, res);
14251    if (json.has("type"))
14252      res.setType(parseCodeableConcept(getJObject(json, "type")));
14253    if (json.has("text"))
14254      res.setTextElement(parseString(json.get("text").getAsString()));
14255    if (json.has("_text"))
14256      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
14257  }
14258
14259  protected Person parsePerson(JsonObject json) throws IOException, FHIRFormatError {
14260    Person res = new Person();
14261    parsePersonProperties(json, res);
14262    return res;
14263  }
14264
14265  protected void parsePersonProperties(JsonObject json, Person res) throws IOException, FHIRFormatError {
14266    parseDomainResourceProperties(json, res);
14267    if (json.has("identifier")) {
14268      JsonArray array = json.getAsJsonArray("identifier");
14269      for (int i = 0; i < array.size(); i++) {
14270        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14271      }
14272    };
14273    if (json.has("name")) {
14274      JsonArray array = json.getAsJsonArray("name");
14275      for (int i = 0; i < array.size(); i++) {
14276        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
14277      }
14278    };
14279    if (json.has("telecom")) {
14280      JsonArray array = json.getAsJsonArray("telecom");
14281      for (int i = 0; i < array.size(); i++) {
14282        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
14283      }
14284    };
14285    if (json.has("gender"))
14286      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
14287    if (json.has("_gender"))
14288      parseElementProperties(getJObject(json, "_gender"), res.getGenderElement());
14289    if (json.has("birthDate"))
14290      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
14291    if (json.has("_birthDate"))
14292      parseElementProperties(getJObject(json, "_birthDate"), res.getBirthDateElement());
14293    if (json.has("address")) {
14294      JsonArray array = json.getAsJsonArray("address");
14295      for (int i = 0; i < array.size(); i++) {
14296        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
14297      }
14298    };
14299    if (json.has("photo"))
14300      res.setPhoto(parseAttachment(getJObject(json, "photo")));
14301    if (json.has("managingOrganization"))
14302      res.setManagingOrganization(parseReference(getJObject(json, "managingOrganization")));
14303    if (json.has("active"))
14304      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
14305    if (json.has("_active"))
14306      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
14307    if (json.has("link")) {
14308      JsonArray array = json.getAsJsonArray("link");
14309      for (int i = 0; i < array.size(); i++) {
14310        res.getLink().add(parsePersonPersonLinkComponent(array.get(i).getAsJsonObject(), res));
14311      }
14312    };
14313  }
14314
14315  protected Person.PersonLinkComponent parsePersonPersonLinkComponent(JsonObject json, Person owner) throws IOException, FHIRFormatError {
14316    Person.PersonLinkComponent res = new Person.PersonLinkComponent();
14317    parsePersonPersonLinkComponentProperties(json, owner, res);
14318    return res;
14319  }
14320
14321  protected void parsePersonPersonLinkComponentProperties(JsonObject json, Person owner, Person.PersonLinkComponent res) throws IOException, FHIRFormatError {
14322    parseBackboneProperties(json, res);
14323    if (json.has("target"))
14324      res.setTarget(parseReference(getJObject(json, "target")));
14325    if (json.has("assurance"))
14326      res.setAssuranceElement(parseEnumeration(json.get("assurance").getAsString(), Person.IdentityAssuranceLevel.NULL, new Person.IdentityAssuranceLevelEnumFactory()));
14327    if (json.has("_assurance"))
14328      parseElementProperties(getJObject(json, "_assurance"), res.getAssuranceElement());
14329  }
14330
14331  protected PlanDefinition parsePlanDefinition(JsonObject json) throws IOException, FHIRFormatError {
14332    PlanDefinition res = new PlanDefinition();
14333    parsePlanDefinitionProperties(json, res);
14334    return res;
14335  }
14336
14337  protected void parsePlanDefinitionProperties(JsonObject json, PlanDefinition res) throws IOException, FHIRFormatError {
14338    parseDomainResourceProperties(json, res);
14339    if (json.has("url"))
14340      res.setUrlElement(parseUri(json.get("url").getAsString()));
14341    if (json.has("_url"))
14342      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
14343    if (json.has("identifier")) {
14344      JsonArray array = json.getAsJsonArray("identifier");
14345      for (int i = 0; i < array.size(); i++) {
14346        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14347      }
14348    };
14349    if (json.has("version"))
14350      res.setVersionElement(parseString(json.get("version").getAsString()));
14351    if (json.has("_version"))
14352      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
14353    if (json.has("name"))
14354      res.setNameElement(parseString(json.get("name").getAsString()));
14355    if (json.has("_name"))
14356      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
14357    if (json.has("title"))
14358      res.setTitleElement(parseString(json.get("title").getAsString()));
14359    if (json.has("_title"))
14360      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
14361    if (json.has("type"))
14362      res.setType(parseCodeableConcept(getJObject(json, "type")));
14363    if (json.has("status"))
14364      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
14365    if (json.has("_status"))
14366      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
14367    if (json.has("experimental"))
14368      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
14369    if (json.has("_experimental"))
14370      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
14371    if (json.has("date"))
14372      res.setDateElement(parseDateTime(json.get("date").getAsString()));
14373    if (json.has("_date"))
14374      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
14375    if (json.has("publisher"))
14376      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
14377    if (json.has("_publisher"))
14378      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
14379    if (json.has("description"))
14380      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
14381    if (json.has("_description"))
14382      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
14383    if (json.has("purpose"))
14384      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
14385    if (json.has("_purpose"))
14386      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
14387    if (json.has("usage"))
14388      res.setUsageElement(parseString(json.get("usage").getAsString()));
14389    if (json.has("_usage"))
14390      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
14391    if (json.has("approvalDate"))
14392      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
14393    if (json.has("_approvalDate"))
14394      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
14395    if (json.has("lastReviewDate"))
14396      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
14397    if (json.has("_lastReviewDate"))
14398      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
14399    if (json.has("effectivePeriod"))
14400      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
14401    if (json.has("useContext")) {
14402      JsonArray array = json.getAsJsonArray("useContext");
14403      for (int i = 0; i < array.size(); i++) {
14404        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
14405      }
14406    };
14407    if (json.has("jurisdiction")) {
14408      JsonArray array = json.getAsJsonArray("jurisdiction");
14409      for (int i = 0; i < array.size(); i++) {
14410        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14411      }
14412    };
14413    if (json.has("topic")) {
14414      JsonArray array = json.getAsJsonArray("topic");
14415      for (int i = 0; i < array.size(); i++) {
14416        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14417      }
14418    };
14419    if (json.has("contributor")) {
14420      JsonArray array = json.getAsJsonArray("contributor");
14421      for (int i = 0; i < array.size(); i++) {
14422        res.getContributor().add(parseContributor(array.get(i).getAsJsonObject()));
14423      }
14424    };
14425    if (json.has("contact")) {
14426      JsonArray array = json.getAsJsonArray("contact");
14427      for (int i = 0; i < array.size(); i++) {
14428        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
14429      }
14430    };
14431    if (json.has("copyright"))
14432      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
14433    if (json.has("_copyright"))
14434      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
14435    if (json.has("relatedArtifact")) {
14436      JsonArray array = json.getAsJsonArray("relatedArtifact");
14437      for (int i = 0; i < array.size(); i++) {
14438        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
14439      }
14440    };
14441    if (json.has("library")) {
14442      JsonArray array = json.getAsJsonArray("library");
14443      for (int i = 0; i < array.size(); i++) {
14444        res.getLibrary().add(parseReference(array.get(i).getAsJsonObject()));
14445      }
14446    };
14447    if (json.has("goal")) {
14448      JsonArray array = json.getAsJsonArray("goal");
14449      for (int i = 0; i < array.size(); i++) {
14450        res.getGoal().add(parsePlanDefinitionPlanDefinitionGoalComponent(array.get(i).getAsJsonObject(), res));
14451      }
14452    };
14453    if (json.has("action")) {
14454      JsonArray array = json.getAsJsonArray("action");
14455      for (int i = 0; i < array.size(); i++) {
14456        res.getAction().add(parsePlanDefinitionPlanDefinitionActionComponent(array.get(i).getAsJsonObject(), res));
14457      }
14458    };
14459  }
14460
14461  protected PlanDefinition.PlanDefinitionGoalComponent parsePlanDefinitionPlanDefinitionGoalComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
14462    PlanDefinition.PlanDefinitionGoalComponent res = new PlanDefinition.PlanDefinitionGoalComponent();
14463    parsePlanDefinitionPlanDefinitionGoalComponentProperties(json, owner, res);
14464    return res;
14465  }
14466
14467  protected void parsePlanDefinitionPlanDefinitionGoalComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionGoalComponent res) throws IOException, FHIRFormatError {
14468    parseBackboneProperties(json, res);
14469    if (json.has("category"))
14470      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
14471    if (json.has("description"))
14472      res.setDescription(parseCodeableConcept(getJObject(json, "description")));
14473    if (json.has("priority"))
14474      res.setPriority(parseCodeableConcept(getJObject(json, "priority")));
14475    if (json.has("start"))
14476      res.setStart(parseCodeableConcept(getJObject(json, "start")));
14477    if (json.has("addresses")) {
14478      JsonArray array = json.getAsJsonArray("addresses");
14479      for (int i = 0; i < array.size(); i++) {
14480        res.getAddresses().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14481      }
14482    };
14483    if (json.has("documentation")) {
14484      JsonArray array = json.getAsJsonArray("documentation");
14485      for (int i = 0; i < array.size(); i++) {
14486        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
14487      }
14488    };
14489    if (json.has("target")) {
14490      JsonArray array = json.getAsJsonArray("target");
14491      for (int i = 0; i < array.size(); i++) {
14492        res.getTarget().add(parsePlanDefinitionPlanDefinitionGoalTargetComponent(array.get(i).getAsJsonObject(), owner));
14493      }
14494    };
14495  }
14496
14497  protected PlanDefinition.PlanDefinitionGoalTargetComponent parsePlanDefinitionPlanDefinitionGoalTargetComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
14498    PlanDefinition.PlanDefinitionGoalTargetComponent res = new PlanDefinition.PlanDefinitionGoalTargetComponent();
14499    parsePlanDefinitionPlanDefinitionGoalTargetComponentProperties(json, owner, res);
14500    return res;
14501  }
14502
14503  protected void parsePlanDefinitionPlanDefinitionGoalTargetComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionGoalTargetComponent res) throws IOException, FHIRFormatError {
14504    parseBackboneProperties(json, res);
14505    if (json.has("measure"))
14506      res.setMeasure(parseCodeableConcept(getJObject(json, "measure")));
14507    Type detail = parseType("detail", json);
14508    if (detail != null)
14509      res.setDetail(detail);
14510    if (json.has("due"))
14511      res.setDue(parseDuration(getJObject(json, "due")));
14512  }
14513
14514  protected PlanDefinition.PlanDefinitionActionComponent parsePlanDefinitionPlanDefinitionActionComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
14515    PlanDefinition.PlanDefinitionActionComponent res = new PlanDefinition.PlanDefinitionActionComponent();
14516    parsePlanDefinitionPlanDefinitionActionComponentProperties(json, owner, res);
14517    return res;
14518  }
14519
14520  protected void parsePlanDefinitionPlanDefinitionActionComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionComponent res) throws IOException, FHIRFormatError {
14521    parseBackboneProperties(json, res);
14522    if (json.has("label"))
14523      res.setLabelElement(parseString(json.get("label").getAsString()));
14524    if (json.has("_label"))
14525      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
14526    if (json.has("title"))
14527      res.setTitleElement(parseString(json.get("title").getAsString()));
14528    if (json.has("_title"))
14529      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
14530    if (json.has("description"))
14531      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14532    if (json.has("_description"))
14533      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
14534    if (json.has("textEquivalent"))
14535      res.setTextEquivalentElement(parseString(json.get("textEquivalent").getAsString()));
14536    if (json.has("_textEquivalent"))
14537      parseElementProperties(getJObject(json, "_textEquivalent"), res.getTextEquivalentElement());
14538    if (json.has("code")) {
14539      JsonArray array = json.getAsJsonArray("code");
14540      for (int i = 0; i < array.size(); i++) {
14541        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14542      }
14543    };
14544    if (json.has("reason")) {
14545      JsonArray array = json.getAsJsonArray("reason");
14546      for (int i = 0; i < array.size(); i++) {
14547        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14548      }
14549    };
14550    if (json.has("documentation")) {
14551      JsonArray array = json.getAsJsonArray("documentation");
14552      for (int i = 0; i < array.size(); i++) {
14553        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
14554      }
14555    };
14556    if (json.has("goalId")) {
14557      JsonArray array = json.getAsJsonArray("goalId");
14558      for (int i = 0; i < array.size(); i++) {
14559        if (array.get(i).isJsonNull()) {
14560          res.getGoalId().add(new IdType());
14561        } else {
14562          res.getGoalId().add(parseId(array.get(i).getAsString()));
14563        }
14564      }
14565    };
14566    if (json.has("_goalId")) {
14567      JsonArray array = json.getAsJsonArray("_goalId");
14568      for (int i = 0; i < array.size(); i++) {
14569        if (i == res.getGoalId().size())
14570          res.getGoalId().add(parseId(null));
14571        if (array.get(i) instanceof JsonObject) 
14572          parseElementProperties(array.get(i).getAsJsonObject(), res.getGoalId().get(i));
14573      }
14574    };
14575    if (json.has("triggerDefinition")) {
14576      JsonArray array = json.getAsJsonArray("triggerDefinition");
14577      for (int i = 0; i < array.size(); i++) {
14578        res.getTriggerDefinition().add(parseTriggerDefinition(array.get(i).getAsJsonObject()));
14579      }
14580    };
14581    if (json.has("condition")) {
14582      JsonArray array = json.getAsJsonArray("condition");
14583      for (int i = 0; i < array.size(); i++) {
14584        res.getCondition().add(parsePlanDefinitionPlanDefinitionActionConditionComponent(array.get(i).getAsJsonObject(), owner));
14585      }
14586    };
14587    if (json.has("input")) {
14588      JsonArray array = json.getAsJsonArray("input");
14589      for (int i = 0; i < array.size(); i++) {
14590        res.getInput().add(parseDataRequirement(array.get(i).getAsJsonObject()));
14591      }
14592    };
14593    if (json.has("output")) {
14594      JsonArray array = json.getAsJsonArray("output");
14595      for (int i = 0; i < array.size(); i++) {
14596        res.getOutput().add(parseDataRequirement(array.get(i).getAsJsonObject()));
14597      }
14598    };
14599    if (json.has("relatedAction")) {
14600      JsonArray array = json.getAsJsonArray("relatedAction");
14601      for (int i = 0; i < array.size(); i++) {
14602        res.getRelatedAction().add(parsePlanDefinitionPlanDefinitionActionRelatedActionComponent(array.get(i).getAsJsonObject(), owner));
14603      }
14604    };
14605    Type timing = parseType("timing", json);
14606    if (timing != null)
14607      res.setTiming(timing);
14608    if (json.has("participant")) {
14609      JsonArray array = json.getAsJsonArray("participant");
14610      for (int i = 0; i < array.size(); i++) {
14611        res.getParticipant().add(parsePlanDefinitionPlanDefinitionActionParticipantComponent(array.get(i).getAsJsonObject(), owner));
14612      }
14613    };
14614    if (json.has("type"))
14615      res.setType(parseCoding(getJObject(json, "type")));
14616    if (json.has("groupingBehavior"))
14617      res.setGroupingBehaviorElement(parseEnumeration(json.get("groupingBehavior").getAsString(), PlanDefinition.ActionGroupingBehavior.NULL, new PlanDefinition.ActionGroupingBehaviorEnumFactory()));
14618    if (json.has("_groupingBehavior"))
14619      parseElementProperties(getJObject(json, "_groupingBehavior"), res.getGroupingBehaviorElement());
14620    if (json.has("selectionBehavior"))
14621      res.setSelectionBehaviorElement(parseEnumeration(json.get("selectionBehavior").getAsString(), PlanDefinition.ActionSelectionBehavior.NULL, new PlanDefinition.ActionSelectionBehaviorEnumFactory()));
14622    if (json.has("_selectionBehavior"))
14623      parseElementProperties(getJObject(json, "_selectionBehavior"), res.getSelectionBehaviorElement());
14624    if (json.has("requiredBehavior"))
14625      res.setRequiredBehaviorElement(parseEnumeration(json.get("requiredBehavior").getAsString(), PlanDefinition.ActionRequiredBehavior.NULL, new PlanDefinition.ActionRequiredBehaviorEnumFactory()));
14626    if (json.has("_requiredBehavior"))
14627      parseElementProperties(getJObject(json, "_requiredBehavior"), res.getRequiredBehaviorElement());
14628    if (json.has("precheckBehavior"))
14629      res.setPrecheckBehaviorElement(parseEnumeration(json.get("precheckBehavior").getAsString(), PlanDefinition.ActionPrecheckBehavior.NULL, new PlanDefinition.ActionPrecheckBehaviorEnumFactory()));
14630    if (json.has("_precheckBehavior"))
14631      parseElementProperties(getJObject(json, "_precheckBehavior"), res.getPrecheckBehaviorElement());
14632    if (json.has("cardinalityBehavior"))
14633      res.setCardinalityBehaviorElement(parseEnumeration(json.get("cardinalityBehavior").getAsString(), PlanDefinition.ActionCardinalityBehavior.NULL, new PlanDefinition.ActionCardinalityBehaviorEnumFactory()));
14634    if (json.has("_cardinalityBehavior"))
14635      parseElementProperties(getJObject(json, "_cardinalityBehavior"), res.getCardinalityBehaviorElement());
14636    if (json.has("definition"))
14637      res.setDefinition(parseReference(getJObject(json, "definition")));
14638    if (json.has("transform"))
14639      res.setTransform(parseReference(getJObject(json, "transform")));
14640    if (json.has("dynamicValue")) {
14641      JsonArray array = json.getAsJsonArray("dynamicValue");
14642      for (int i = 0; i < array.size(); i++) {
14643        res.getDynamicValue().add(parsePlanDefinitionPlanDefinitionActionDynamicValueComponent(array.get(i).getAsJsonObject(), owner));
14644      }
14645    };
14646    if (json.has("action")) {
14647      JsonArray array = json.getAsJsonArray("action");
14648      for (int i = 0; i < array.size(); i++) {
14649        res.getAction().add(parsePlanDefinitionPlanDefinitionActionComponent(array.get(i).getAsJsonObject(), owner));
14650      }
14651    };
14652  }
14653
14654  protected PlanDefinition.PlanDefinitionActionConditionComponent parsePlanDefinitionPlanDefinitionActionConditionComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
14655    PlanDefinition.PlanDefinitionActionConditionComponent res = new PlanDefinition.PlanDefinitionActionConditionComponent();
14656    parsePlanDefinitionPlanDefinitionActionConditionComponentProperties(json, owner, res);
14657    return res;
14658  }
14659
14660  protected void parsePlanDefinitionPlanDefinitionActionConditionComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionConditionComponent res) throws IOException, FHIRFormatError {
14661    parseBackboneProperties(json, res);
14662    if (json.has("kind"))
14663      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), PlanDefinition.ActionConditionKind.NULL, new PlanDefinition.ActionConditionKindEnumFactory()));
14664    if (json.has("_kind"))
14665      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
14666    if (json.has("description"))
14667      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14668    if (json.has("_description"))
14669      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
14670    if (json.has("language"))
14671      res.setLanguageElement(parseString(json.get("language").getAsString()));
14672    if (json.has("_language"))
14673      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
14674    if (json.has("expression"))
14675      res.setExpressionElement(parseString(json.get("expression").getAsString()));
14676    if (json.has("_expression"))
14677      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
14678  }
14679
14680  protected PlanDefinition.PlanDefinitionActionRelatedActionComponent parsePlanDefinitionPlanDefinitionActionRelatedActionComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
14681    PlanDefinition.PlanDefinitionActionRelatedActionComponent res = new PlanDefinition.PlanDefinitionActionRelatedActionComponent();
14682    parsePlanDefinitionPlanDefinitionActionRelatedActionComponentProperties(json, owner, res);
14683    return res;
14684  }
14685
14686  protected void parsePlanDefinitionPlanDefinitionActionRelatedActionComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionRelatedActionComponent res) throws IOException, FHIRFormatError {
14687    parseBackboneProperties(json, res);
14688    if (json.has("actionId"))
14689      res.setActionIdElement(parseId(json.get("actionId").getAsString()));
14690    if (json.has("_actionId"))
14691      parseElementProperties(getJObject(json, "_actionId"), res.getActionIdElement());
14692    if (json.has("relationship"))
14693      res.setRelationshipElement(parseEnumeration(json.get("relationship").getAsString(), PlanDefinition.ActionRelationshipType.NULL, new PlanDefinition.ActionRelationshipTypeEnumFactory()));
14694    if (json.has("_relationship"))
14695      parseElementProperties(getJObject(json, "_relationship"), res.getRelationshipElement());
14696    Type offset = parseType("offset", json);
14697    if (offset != null)
14698      res.setOffset(offset);
14699  }
14700
14701  protected PlanDefinition.PlanDefinitionActionParticipantComponent parsePlanDefinitionPlanDefinitionActionParticipantComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
14702    PlanDefinition.PlanDefinitionActionParticipantComponent res = new PlanDefinition.PlanDefinitionActionParticipantComponent();
14703    parsePlanDefinitionPlanDefinitionActionParticipantComponentProperties(json, owner, res);
14704    return res;
14705  }
14706
14707  protected void parsePlanDefinitionPlanDefinitionActionParticipantComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionParticipantComponent res) throws IOException, FHIRFormatError {
14708    parseBackboneProperties(json, res);
14709    if (json.has("type"))
14710      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), PlanDefinition.ActionParticipantType.NULL, new PlanDefinition.ActionParticipantTypeEnumFactory()));
14711    if (json.has("_type"))
14712      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
14713    if (json.has("role"))
14714      res.setRole(parseCodeableConcept(getJObject(json, "role")));
14715  }
14716
14717  protected PlanDefinition.PlanDefinitionActionDynamicValueComponent parsePlanDefinitionPlanDefinitionActionDynamicValueComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
14718    PlanDefinition.PlanDefinitionActionDynamicValueComponent res = new PlanDefinition.PlanDefinitionActionDynamicValueComponent();
14719    parsePlanDefinitionPlanDefinitionActionDynamicValueComponentProperties(json, owner, res);
14720    return res;
14721  }
14722
14723  protected void parsePlanDefinitionPlanDefinitionActionDynamicValueComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionDynamicValueComponent res) throws IOException, FHIRFormatError {
14724    parseBackboneProperties(json, res);
14725    if (json.has("description"))
14726      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14727    if (json.has("_description"))
14728      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
14729    if (json.has("path"))
14730      res.setPathElement(parseString(json.get("path").getAsString()));
14731    if (json.has("_path"))
14732      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
14733    if (json.has("language"))
14734      res.setLanguageElement(parseString(json.get("language").getAsString()));
14735    if (json.has("_language"))
14736      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
14737    if (json.has("expression"))
14738      res.setExpressionElement(parseString(json.get("expression").getAsString()));
14739    if (json.has("_expression"))
14740      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
14741  }
14742
14743  protected Practitioner parsePractitioner(JsonObject json) throws IOException, FHIRFormatError {
14744    Practitioner res = new Practitioner();
14745    parsePractitionerProperties(json, res);
14746    return res;
14747  }
14748
14749  protected void parsePractitionerProperties(JsonObject json, Practitioner res) throws IOException, FHIRFormatError {
14750    parseDomainResourceProperties(json, res);
14751    if (json.has("identifier")) {
14752      JsonArray array = json.getAsJsonArray("identifier");
14753      for (int i = 0; i < array.size(); i++) {
14754        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14755      }
14756    };
14757    if (json.has("active"))
14758      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
14759    if (json.has("_active"))
14760      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
14761    if (json.has("name")) {
14762      JsonArray array = json.getAsJsonArray("name");
14763      for (int i = 0; i < array.size(); i++) {
14764        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
14765      }
14766    };
14767    if (json.has("telecom")) {
14768      JsonArray array = json.getAsJsonArray("telecom");
14769      for (int i = 0; i < array.size(); i++) {
14770        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
14771      }
14772    };
14773    if (json.has("address")) {
14774      JsonArray array = json.getAsJsonArray("address");
14775      for (int i = 0; i < array.size(); i++) {
14776        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
14777      }
14778    };
14779    if (json.has("gender"))
14780      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
14781    if (json.has("_gender"))
14782      parseElementProperties(getJObject(json, "_gender"), res.getGenderElement());
14783    if (json.has("birthDate"))
14784      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
14785    if (json.has("_birthDate"))
14786      parseElementProperties(getJObject(json, "_birthDate"), res.getBirthDateElement());
14787    if (json.has("photo")) {
14788      JsonArray array = json.getAsJsonArray("photo");
14789      for (int i = 0; i < array.size(); i++) {
14790        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
14791      }
14792    };
14793    if (json.has("qualification")) {
14794      JsonArray array = json.getAsJsonArray("qualification");
14795      for (int i = 0; i < array.size(); i++) {
14796        res.getQualification().add(parsePractitionerPractitionerQualificationComponent(array.get(i).getAsJsonObject(), res));
14797      }
14798    };
14799    if (json.has("communication")) {
14800      JsonArray array = json.getAsJsonArray("communication");
14801      for (int i = 0; i < array.size(); i++) {
14802        res.getCommunication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14803      }
14804    };
14805  }
14806
14807  protected Practitioner.PractitionerQualificationComponent parsePractitionerPractitionerQualificationComponent(JsonObject json, Practitioner owner) throws IOException, FHIRFormatError {
14808    Practitioner.PractitionerQualificationComponent res = new Practitioner.PractitionerQualificationComponent();
14809    parsePractitionerPractitionerQualificationComponentProperties(json, owner, res);
14810    return res;
14811  }
14812
14813  protected void parsePractitionerPractitionerQualificationComponentProperties(JsonObject json, Practitioner owner, Practitioner.PractitionerQualificationComponent res) throws IOException, FHIRFormatError {
14814    parseBackboneProperties(json, res);
14815    if (json.has("identifier")) {
14816      JsonArray array = json.getAsJsonArray("identifier");
14817      for (int i = 0; i < array.size(); i++) {
14818        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14819      }
14820    };
14821    if (json.has("code"))
14822      res.setCode(parseCodeableConcept(getJObject(json, "code")));
14823    if (json.has("period"))
14824      res.setPeriod(parsePeriod(getJObject(json, "period")));
14825    if (json.has("issuer"))
14826      res.setIssuer(parseReference(getJObject(json, "issuer")));
14827  }
14828
14829  protected PractitionerRole parsePractitionerRole(JsonObject json) throws IOException, FHIRFormatError {
14830    PractitionerRole res = new PractitionerRole();
14831    parsePractitionerRoleProperties(json, res);
14832    return res;
14833  }
14834
14835  protected void parsePractitionerRoleProperties(JsonObject json, PractitionerRole res) throws IOException, FHIRFormatError {
14836    parseDomainResourceProperties(json, res);
14837    if (json.has("identifier")) {
14838      JsonArray array = json.getAsJsonArray("identifier");
14839      for (int i = 0; i < array.size(); i++) {
14840        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14841      }
14842    };
14843    if (json.has("active"))
14844      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
14845    if (json.has("_active"))
14846      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
14847    if (json.has("period"))
14848      res.setPeriod(parsePeriod(getJObject(json, "period")));
14849    if (json.has("practitioner"))
14850      res.setPractitioner(parseReference(getJObject(json, "practitioner")));
14851    if (json.has("organization"))
14852      res.setOrganization(parseReference(getJObject(json, "organization")));
14853    if (json.has("code")) {
14854      JsonArray array = json.getAsJsonArray("code");
14855      for (int i = 0; i < array.size(); i++) {
14856        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14857      }
14858    };
14859    if (json.has("specialty")) {
14860      JsonArray array = json.getAsJsonArray("specialty");
14861      for (int i = 0; i < array.size(); i++) {
14862        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14863      }
14864    };
14865    if (json.has("location")) {
14866      JsonArray array = json.getAsJsonArray("location");
14867      for (int i = 0; i < array.size(); i++) {
14868        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
14869      }
14870    };
14871    if (json.has("healthcareService")) {
14872      JsonArray array = json.getAsJsonArray("healthcareService");
14873      for (int i = 0; i < array.size(); i++) {
14874        res.getHealthcareService().add(parseReference(array.get(i).getAsJsonObject()));
14875      }
14876    };
14877    if (json.has("telecom")) {
14878      JsonArray array = json.getAsJsonArray("telecom");
14879      for (int i = 0; i < array.size(); i++) {
14880        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
14881      }
14882    };
14883    if (json.has("availableTime")) {
14884      JsonArray array = json.getAsJsonArray("availableTime");
14885      for (int i = 0; i < array.size(); i++) {
14886        res.getAvailableTime().add(parsePractitionerRolePractitionerRoleAvailableTimeComponent(array.get(i).getAsJsonObject(), res));
14887      }
14888    };
14889    if (json.has("notAvailable")) {
14890      JsonArray array = json.getAsJsonArray("notAvailable");
14891      for (int i = 0; i < array.size(); i++) {
14892        res.getNotAvailable().add(parsePractitionerRolePractitionerRoleNotAvailableComponent(array.get(i).getAsJsonObject(), res));
14893      }
14894    };
14895    if (json.has("availabilityExceptions"))
14896      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
14897    if (json.has("_availabilityExceptions"))
14898      parseElementProperties(getJObject(json, "_availabilityExceptions"), res.getAvailabilityExceptionsElement());
14899    if (json.has("endpoint")) {
14900      JsonArray array = json.getAsJsonArray("endpoint");
14901      for (int i = 0; i < array.size(); i++) {
14902        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
14903      }
14904    };
14905  }
14906
14907  protected PractitionerRole.PractitionerRoleAvailableTimeComponent parsePractitionerRolePractitionerRoleAvailableTimeComponent(JsonObject json, PractitionerRole owner) throws IOException, FHIRFormatError {
14908    PractitionerRole.PractitionerRoleAvailableTimeComponent res = new PractitionerRole.PractitionerRoleAvailableTimeComponent();
14909    parsePractitionerRolePractitionerRoleAvailableTimeComponentProperties(json, owner, res);
14910    return res;
14911  }
14912
14913  protected void parsePractitionerRolePractitionerRoleAvailableTimeComponentProperties(JsonObject json, PractitionerRole owner, PractitionerRole.PractitionerRoleAvailableTimeComponent res) throws IOException, FHIRFormatError {
14914    parseBackboneProperties(json, res);
14915    if (json.has("daysOfWeek")) {
14916      JsonArray array = json.getAsJsonArray("daysOfWeek");
14917      for (int i = 0; i < array.size(); i++) {
14918        if (array.get(i).isJsonNull()) {
14919          res.getDaysOfWeek().add(new Enumeration<PractitionerRole.DaysOfWeek>());
14920        } else {
14921          res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), PractitionerRole.DaysOfWeek.NULL, new PractitionerRole.DaysOfWeekEnumFactory()));
14922        }
14923      }
14924    };
14925    if (json.has("_daysOfWeek")) {
14926      JsonArray array = json.getAsJsonArray("_daysOfWeek");
14927      for (int i = 0; i < array.size(); i++) {
14928        if (i == res.getDaysOfWeek().size())
14929          res.getDaysOfWeek().add(parseEnumeration(null, PractitionerRole.DaysOfWeek.NULL, new PractitionerRole.DaysOfWeekEnumFactory()));
14930        if (array.get(i) instanceof JsonObject) 
14931          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
14932      }
14933    };
14934    if (json.has("allDay"))
14935      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
14936    if (json.has("_allDay"))
14937      parseElementProperties(getJObject(json, "_allDay"), res.getAllDayElement());
14938    if (json.has("availableStartTime"))
14939      res.setAvailableStartTimeElement(parseTime(json.get("availableStartTime").getAsString()));
14940    if (json.has("_availableStartTime"))
14941      parseElementProperties(getJObject(json, "_availableStartTime"), res.getAvailableStartTimeElement());
14942    if (json.has("availableEndTime"))
14943      res.setAvailableEndTimeElement(parseTime(json.get("availableEndTime").getAsString()));
14944    if (json.has("_availableEndTime"))
14945      parseElementProperties(getJObject(json, "_availableEndTime"), res.getAvailableEndTimeElement());
14946  }
14947
14948  protected PractitionerRole.PractitionerRoleNotAvailableComponent parsePractitionerRolePractitionerRoleNotAvailableComponent(JsonObject json, PractitionerRole owner) throws IOException, FHIRFormatError {
14949    PractitionerRole.PractitionerRoleNotAvailableComponent res = new PractitionerRole.PractitionerRoleNotAvailableComponent();
14950    parsePractitionerRolePractitionerRoleNotAvailableComponentProperties(json, owner, res);
14951    return res;
14952  }
14953
14954  protected void parsePractitionerRolePractitionerRoleNotAvailableComponentProperties(JsonObject json, PractitionerRole owner, PractitionerRole.PractitionerRoleNotAvailableComponent res) throws IOException, FHIRFormatError {
14955    parseBackboneProperties(json, res);
14956    if (json.has("description"))
14957      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14958    if (json.has("_description"))
14959      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
14960    if (json.has("during"))
14961      res.setDuring(parsePeriod(getJObject(json, "during")));
14962  }
14963
14964  protected Procedure parseProcedure(JsonObject json) throws IOException, FHIRFormatError {
14965    Procedure res = new Procedure();
14966    parseProcedureProperties(json, res);
14967    return res;
14968  }
14969
14970  protected void parseProcedureProperties(JsonObject json, Procedure res) throws IOException, FHIRFormatError {
14971    parseDomainResourceProperties(json, res);
14972    if (json.has("identifier")) {
14973      JsonArray array = json.getAsJsonArray("identifier");
14974      for (int i = 0; i < array.size(); i++) {
14975        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14976      }
14977    };
14978    if (json.has("definition")) {
14979      JsonArray array = json.getAsJsonArray("definition");
14980      for (int i = 0; i < array.size(); i++) {
14981        res.getDefinition().add(parseReference(array.get(i).getAsJsonObject()));
14982      }
14983    };
14984    if (json.has("basedOn")) {
14985      JsonArray array = json.getAsJsonArray("basedOn");
14986      for (int i = 0; i < array.size(); i++) {
14987        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
14988      }
14989    };
14990    if (json.has("partOf")) {
14991      JsonArray array = json.getAsJsonArray("partOf");
14992      for (int i = 0; i < array.size(); i++) {
14993        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
14994      }
14995    };
14996    if (json.has("status"))
14997      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Procedure.ProcedureStatus.NULL, new Procedure.ProcedureStatusEnumFactory()));
14998    if (json.has("_status"))
14999      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
15000    if (json.has("notDone"))
15001      res.setNotDoneElement(parseBoolean(json.get("notDone").getAsBoolean()));
15002    if (json.has("_notDone"))
15003      parseElementProperties(getJObject(json, "_notDone"), res.getNotDoneElement());
15004    if (json.has("notDoneReason"))
15005      res.setNotDoneReason(parseCodeableConcept(getJObject(json, "notDoneReason")));
15006    if (json.has("category"))
15007      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
15008    if (json.has("code"))
15009      res.setCode(parseCodeableConcept(getJObject(json, "code")));
15010    if (json.has("subject"))
15011      res.setSubject(parseReference(getJObject(json, "subject")));
15012    if (json.has("context"))
15013      res.setContext(parseReference(getJObject(json, "context")));
15014    Type performed = parseType("performed", json);
15015    if (performed != null)
15016      res.setPerformed(performed);
15017    if (json.has("performer")) {
15018      JsonArray array = json.getAsJsonArray("performer");
15019      for (int i = 0; i < array.size(); i++) {
15020        res.getPerformer().add(parseProcedureProcedurePerformerComponent(array.get(i).getAsJsonObject(), res));
15021      }
15022    };
15023    if (json.has("location"))
15024      res.setLocation(parseReference(getJObject(json, "location")));
15025    if (json.has("reasonCode")) {
15026      JsonArray array = json.getAsJsonArray("reasonCode");
15027      for (int i = 0; i < array.size(); i++) {
15028        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15029      }
15030    };
15031    if (json.has("reasonReference")) {
15032      JsonArray array = json.getAsJsonArray("reasonReference");
15033      for (int i = 0; i < array.size(); i++) {
15034        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
15035      }
15036    };
15037    if (json.has("bodySite")) {
15038      JsonArray array = json.getAsJsonArray("bodySite");
15039      for (int i = 0; i < array.size(); i++) {
15040        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15041      }
15042    };
15043    if (json.has("outcome"))
15044      res.setOutcome(parseCodeableConcept(getJObject(json, "outcome")));
15045    if (json.has("report")) {
15046      JsonArray array = json.getAsJsonArray("report");
15047      for (int i = 0; i < array.size(); i++) {
15048        res.getReport().add(parseReference(array.get(i).getAsJsonObject()));
15049      }
15050    };
15051    if (json.has("complication")) {
15052      JsonArray array = json.getAsJsonArray("complication");
15053      for (int i = 0; i < array.size(); i++) {
15054        res.getComplication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15055      }
15056    };
15057    if (json.has("complicationDetail")) {
15058      JsonArray array = json.getAsJsonArray("complicationDetail");
15059      for (int i = 0; i < array.size(); i++) {
15060        res.getComplicationDetail().add(parseReference(array.get(i).getAsJsonObject()));
15061      }
15062    };
15063    if (json.has("followUp")) {
15064      JsonArray array = json.getAsJsonArray("followUp");
15065      for (int i = 0; i < array.size(); i++) {
15066        res.getFollowUp().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15067      }
15068    };
15069    if (json.has("note")) {
15070      JsonArray array = json.getAsJsonArray("note");
15071      for (int i = 0; i < array.size(); i++) {
15072        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
15073      }
15074    };
15075    if (json.has("focalDevice")) {
15076      JsonArray array = json.getAsJsonArray("focalDevice");
15077      for (int i = 0; i < array.size(); i++) {
15078        res.getFocalDevice().add(parseProcedureProcedureFocalDeviceComponent(array.get(i).getAsJsonObject(), res));
15079      }
15080    };
15081    if (json.has("usedReference")) {
15082      JsonArray array = json.getAsJsonArray("usedReference");
15083      for (int i = 0; i < array.size(); i++) {
15084        res.getUsedReference().add(parseReference(array.get(i).getAsJsonObject()));
15085      }
15086    };
15087    if (json.has("usedCode")) {
15088      JsonArray array = json.getAsJsonArray("usedCode");
15089      for (int i = 0; i < array.size(); i++) {
15090        res.getUsedCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15091      }
15092    };
15093  }
15094
15095  protected Procedure.ProcedurePerformerComponent parseProcedureProcedurePerformerComponent(JsonObject json, Procedure owner) throws IOException, FHIRFormatError {
15096    Procedure.ProcedurePerformerComponent res = new Procedure.ProcedurePerformerComponent();
15097    parseProcedureProcedurePerformerComponentProperties(json, owner, res);
15098    return res;
15099  }
15100
15101  protected void parseProcedureProcedurePerformerComponentProperties(JsonObject json, Procedure owner, Procedure.ProcedurePerformerComponent res) throws IOException, FHIRFormatError {
15102    parseBackboneProperties(json, res);
15103    if (json.has("role"))
15104      res.setRole(parseCodeableConcept(getJObject(json, "role")));
15105    if (json.has("actor"))
15106      res.setActor(parseReference(getJObject(json, "actor")));
15107    if (json.has("onBehalfOf"))
15108      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
15109  }
15110
15111  protected Procedure.ProcedureFocalDeviceComponent parseProcedureProcedureFocalDeviceComponent(JsonObject json, Procedure owner) throws IOException, FHIRFormatError {
15112    Procedure.ProcedureFocalDeviceComponent res = new Procedure.ProcedureFocalDeviceComponent();
15113    parseProcedureProcedureFocalDeviceComponentProperties(json, owner, res);
15114    return res;
15115  }
15116
15117  protected void parseProcedureProcedureFocalDeviceComponentProperties(JsonObject json, Procedure owner, Procedure.ProcedureFocalDeviceComponent res) throws IOException, FHIRFormatError {
15118    parseBackboneProperties(json, res);
15119    if (json.has("action"))
15120      res.setAction(parseCodeableConcept(getJObject(json, "action")));
15121    if (json.has("manipulated"))
15122      res.setManipulated(parseReference(getJObject(json, "manipulated")));
15123  }
15124
15125  protected ProcedureRequest parseProcedureRequest(JsonObject json) throws IOException, FHIRFormatError {
15126    ProcedureRequest res = new ProcedureRequest();
15127    parseProcedureRequestProperties(json, res);
15128    return res;
15129  }
15130
15131  protected void parseProcedureRequestProperties(JsonObject json, ProcedureRequest res) throws IOException, FHIRFormatError {
15132    parseDomainResourceProperties(json, res);
15133    if (json.has("identifier")) {
15134      JsonArray array = json.getAsJsonArray("identifier");
15135      for (int i = 0; i < array.size(); i++) {
15136        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15137      }
15138    };
15139    if (json.has("definition")) {
15140      JsonArray array = json.getAsJsonArray("definition");
15141      for (int i = 0; i < array.size(); i++) {
15142        res.getDefinition().add(parseReference(array.get(i).getAsJsonObject()));
15143      }
15144    };
15145    if (json.has("basedOn")) {
15146      JsonArray array = json.getAsJsonArray("basedOn");
15147      for (int i = 0; i < array.size(); i++) {
15148        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
15149      }
15150    };
15151    if (json.has("replaces")) {
15152      JsonArray array = json.getAsJsonArray("replaces");
15153      for (int i = 0; i < array.size(); i++) {
15154        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
15155      }
15156    };
15157    if (json.has("requisition"))
15158      res.setRequisition(parseIdentifier(getJObject(json, "requisition")));
15159    if (json.has("status"))
15160      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ProcedureRequest.ProcedureRequestStatus.NULL, new ProcedureRequest.ProcedureRequestStatusEnumFactory()));
15161    if (json.has("_status"))
15162      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
15163    if (json.has("intent"))
15164      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), ProcedureRequest.ProcedureRequestIntent.NULL, new ProcedureRequest.ProcedureRequestIntentEnumFactory()));
15165    if (json.has("_intent"))
15166      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
15167    if (json.has("priority"))
15168      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), ProcedureRequest.ProcedureRequestPriority.NULL, new ProcedureRequest.ProcedureRequestPriorityEnumFactory()));
15169    if (json.has("_priority"))
15170      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
15171    if (json.has("doNotPerform"))
15172      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
15173    if (json.has("_doNotPerform"))
15174      parseElementProperties(getJObject(json, "_doNotPerform"), res.getDoNotPerformElement());
15175    if (json.has("category")) {
15176      JsonArray array = json.getAsJsonArray("category");
15177      for (int i = 0; i < array.size(); i++) {
15178        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15179      }
15180    };
15181    if (json.has("code"))
15182      res.setCode(parseCodeableConcept(getJObject(json, "code")));
15183    if (json.has("subject"))
15184      res.setSubject(parseReference(getJObject(json, "subject")));
15185    if (json.has("context"))
15186      res.setContext(parseReference(getJObject(json, "context")));
15187    Type occurrence = parseType("occurrence", json);
15188    if (occurrence != null)
15189      res.setOccurrence(occurrence);
15190    Type asNeeded = parseType("asNeeded", json);
15191    if (asNeeded != null)
15192      res.setAsNeeded(asNeeded);
15193    if (json.has("authoredOn"))
15194      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
15195    if (json.has("_authoredOn"))
15196      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
15197    if (json.has("requester"))
15198      res.setRequester(parseProcedureRequestProcedureRequestRequesterComponent(getJObject(json, "requester"), res));
15199    if (json.has("performerType"))
15200      res.setPerformerType(parseCodeableConcept(getJObject(json, "performerType")));
15201    if (json.has("performer"))
15202      res.setPerformer(parseReference(getJObject(json, "performer")));
15203    if (json.has("reasonCode")) {
15204      JsonArray array = json.getAsJsonArray("reasonCode");
15205      for (int i = 0; i < array.size(); i++) {
15206        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15207      }
15208    };
15209    if (json.has("reasonReference")) {
15210      JsonArray array = json.getAsJsonArray("reasonReference");
15211      for (int i = 0; i < array.size(); i++) {
15212        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
15213      }
15214    };
15215    if (json.has("supportingInfo")) {
15216      JsonArray array = json.getAsJsonArray("supportingInfo");
15217      for (int i = 0; i < array.size(); i++) {
15218        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
15219      }
15220    };
15221    if (json.has("specimen")) {
15222      JsonArray array = json.getAsJsonArray("specimen");
15223      for (int i = 0; i < array.size(); i++) {
15224        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
15225      }
15226    };
15227    if (json.has("bodySite")) {
15228      JsonArray array = json.getAsJsonArray("bodySite");
15229      for (int i = 0; i < array.size(); i++) {
15230        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15231      }
15232    };
15233    if (json.has("note")) {
15234      JsonArray array = json.getAsJsonArray("note");
15235      for (int i = 0; i < array.size(); i++) {
15236        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
15237      }
15238    };
15239    if (json.has("relevantHistory")) {
15240      JsonArray array = json.getAsJsonArray("relevantHistory");
15241      for (int i = 0; i < array.size(); i++) {
15242        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
15243      }
15244    };
15245  }
15246
15247  protected ProcedureRequest.ProcedureRequestRequesterComponent parseProcedureRequestProcedureRequestRequesterComponent(JsonObject json, ProcedureRequest owner) throws IOException, FHIRFormatError {
15248    ProcedureRequest.ProcedureRequestRequesterComponent res = new ProcedureRequest.ProcedureRequestRequesterComponent();
15249    parseProcedureRequestProcedureRequestRequesterComponentProperties(json, owner, res);
15250    return res;
15251  }
15252
15253  protected void parseProcedureRequestProcedureRequestRequesterComponentProperties(JsonObject json, ProcedureRequest owner, ProcedureRequest.ProcedureRequestRequesterComponent res) throws IOException, FHIRFormatError {
15254    parseBackboneProperties(json, res);
15255    if (json.has("agent"))
15256      res.setAgent(parseReference(getJObject(json, "agent")));
15257    if (json.has("onBehalfOf"))
15258      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
15259  }
15260
15261  protected ProcessRequest parseProcessRequest(JsonObject json) throws IOException, FHIRFormatError {
15262    ProcessRequest res = new ProcessRequest();
15263    parseProcessRequestProperties(json, res);
15264    return res;
15265  }
15266
15267  protected void parseProcessRequestProperties(JsonObject json, ProcessRequest res) throws IOException, FHIRFormatError {
15268    parseDomainResourceProperties(json, res);
15269    if (json.has("identifier")) {
15270      JsonArray array = json.getAsJsonArray("identifier");
15271      for (int i = 0; i < array.size(); i++) {
15272        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15273      }
15274    };
15275    if (json.has("status"))
15276      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ProcessRequest.ProcessRequestStatus.NULL, new ProcessRequest.ProcessRequestStatusEnumFactory()));
15277    if (json.has("_status"))
15278      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
15279    if (json.has("action"))
15280      res.setActionElement(parseEnumeration(json.get("action").getAsString(), ProcessRequest.ActionList.NULL, new ProcessRequest.ActionListEnumFactory()));
15281    if (json.has("_action"))
15282      parseElementProperties(getJObject(json, "_action"), res.getActionElement());
15283    if (json.has("target"))
15284      res.setTarget(parseReference(getJObject(json, "target")));
15285    if (json.has("created"))
15286      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
15287    if (json.has("_created"))
15288      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
15289    if (json.has("provider"))
15290      res.setProvider(parseReference(getJObject(json, "provider")));
15291    if (json.has("organization"))
15292      res.setOrganization(parseReference(getJObject(json, "organization")));
15293    if (json.has("request"))
15294      res.setRequest(parseReference(getJObject(json, "request")));
15295    if (json.has("response"))
15296      res.setResponse(parseReference(getJObject(json, "response")));
15297    if (json.has("nullify"))
15298      res.setNullifyElement(parseBoolean(json.get("nullify").getAsBoolean()));
15299    if (json.has("_nullify"))
15300      parseElementProperties(getJObject(json, "_nullify"), res.getNullifyElement());
15301    if (json.has("reference"))
15302      res.setReferenceElement(parseString(json.get("reference").getAsString()));
15303    if (json.has("_reference"))
15304      parseElementProperties(getJObject(json, "_reference"), res.getReferenceElement());
15305    if (json.has("item")) {
15306      JsonArray array = json.getAsJsonArray("item");
15307      for (int i = 0; i < array.size(); i++) {
15308        res.getItem().add(parseProcessRequestItemsComponent(array.get(i).getAsJsonObject(), res));
15309      }
15310    };
15311    if (json.has("include")) {
15312      JsonArray array = json.getAsJsonArray("include");
15313      for (int i = 0; i < array.size(); i++) {
15314        if (array.get(i).isJsonNull()) {
15315          res.getInclude().add(new StringType());
15316        } else {
15317          res.getInclude().add(parseString(array.get(i).getAsString()));
15318        }
15319      }
15320    };
15321    if (json.has("_include")) {
15322      JsonArray array = json.getAsJsonArray("_include");
15323      for (int i = 0; i < array.size(); i++) {
15324        if (i == res.getInclude().size())
15325          res.getInclude().add(parseString(null));
15326        if (array.get(i) instanceof JsonObject) 
15327          parseElementProperties(array.get(i).getAsJsonObject(), res.getInclude().get(i));
15328      }
15329    };
15330    if (json.has("exclude")) {
15331      JsonArray array = json.getAsJsonArray("exclude");
15332      for (int i = 0; i < array.size(); i++) {
15333        if (array.get(i).isJsonNull()) {
15334          res.getExclude().add(new StringType());
15335        } else {
15336          res.getExclude().add(parseString(array.get(i).getAsString()));
15337        }
15338      }
15339    };
15340    if (json.has("_exclude")) {
15341      JsonArray array = json.getAsJsonArray("_exclude");
15342      for (int i = 0; i < array.size(); i++) {
15343        if (i == res.getExclude().size())
15344          res.getExclude().add(parseString(null));
15345        if (array.get(i) instanceof JsonObject) 
15346          parseElementProperties(array.get(i).getAsJsonObject(), res.getExclude().get(i));
15347      }
15348    };
15349    if (json.has("period"))
15350      res.setPeriod(parsePeriod(getJObject(json, "period")));
15351  }
15352
15353  protected ProcessRequest.ItemsComponent parseProcessRequestItemsComponent(JsonObject json, ProcessRequest owner) throws IOException, FHIRFormatError {
15354    ProcessRequest.ItemsComponent res = new ProcessRequest.ItemsComponent();
15355    parseProcessRequestItemsComponentProperties(json, owner, res);
15356    return res;
15357  }
15358
15359  protected void parseProcessRequestItemsComponentProperties(JsonObject json, ProcessRequest owner, ProcessRequest.ItemsComponent res) throws IOException, FHIRFormatError {
15360    parseBackboneProperties(json, res);
15361    if (json.has("sequenceLinkId"))
15362      res.setSequenceLinkIdElement(parseInteger(json.get("sequenceLinkId").getAsLong()));
15363    if (json.has("_sequenceLinkId"))
15364      parseElementProperties(getJObject(json, "_sequenceLinkId"), res.getSequenceLinkIdElement());
15365  }
15366
15367  protected ProcessResponse parseProcessResponse(JsonObject json) throws IOException, FHIRFormatError {
15368    ProcessResponse res = new ProcessResponse();
15369    parseProcessResponseProperties(json, res);
15370    return res;
15371  }
15372
15373  protected void parseProcessResponseProperties(JsonObject json, ProcessResponse res) throws IOException, FHIRFormatError {
15374    parseDomainResourceProperties(json, res);
15375    if (json.has("identifier")) {
15376      JsonArray array = json.getAsJsonArray("identifier");
15377      for (int i = 0; i < array.size(); i++) {
15378        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15379      }
15380    };
15381    if (json.has("status"))
15382      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ProcessResponse.ProcessResponseStatus.NULL, new ProcessResponse.ProcessResponseStatusEnumFactory()));
15383    if (json.has("_status"))
15384      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
15385    if (json.has("created"))
15386      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
15387    if (json.has("_created"))
15388      parseElementProperties(getJObject(json, "_created"), res.getCreatedElement());
15389    if (json.has("organization"))
15390      res.setOrganization(parseReference(getJObject(json, "organization")));
15391    if (json.has("request"))
15392      res.setRequest(parseReference(getJObject(json, "request")));
15393    if (json.has("outcome"))
15394      res.setOutcome(parseCodeableConcept(getJObject(json, "outcome")));
15395    if (json.has("disposition"))
15396      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
15397    if (json.has("_disposition"))
15398      parseElementProperties(getJObject(json, "_disposition"), res.getDispositionElement());
15399    if (json.has("requestProvider"))
15400      res.setRequestProvider(parseReference(getJObject(json, "requestProvider")));
15401    if (json.has("requestOrganization"))
15402      res.setRequestOrganization(parseReference(getJObject(json, "requestOrganization")));
15403    if (json.has("form"))
15404      res.setForm(parseCodeableConcept(getJObject(json, "form")));
15405    if (json.has("processNote")) {
15406      JsonArray array = json.getAsJsonArray("processNote");
15407      for (int i = 0; i < array.size(); i++) {
15408        res.getProcessNote().add(parseProcessResponseProcessResponseProcessNoteComponent(array.get(i).getAsJsonObject(), res));
15409      }
15410    };
15411    if (json.has("error")) {
15412      JsonArray array = json.getAsJsonArray("error");
15413      for (int i = 0; i < array.size(); i++) {
15414        res.getError().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15415      }
15416    };
15417    if (json.has("communicationRequest")) {
15418      JsonArray array = json.getAsJsonArray("communicationRequest");
15419      for (int i = 0; i < array.size(); i++) {
15420        res.getCommunicationRequest().add(parseReference(array.get(i).getAsJsonObject()));
15421      }
15422    };
15423  }
15424
15425  protected ProcessResponse.ProcessResponseProcessNoteComponent parseProcessResponseProcessResponseProcessNoteComponent(JsonObject json, ProcessResponse owner) throws IOException, FHIRFormatError {
15426    ProcessResponse.ProcessResponseProcessNoteComponent res = new ProcessResponse.ProcessResponseProcessNoteComponent();
15427    parseProcessResponseProcessResponseProcessNoteComponentProperties(json, owner, res);
15428    return res;
15429  }
15430
15431  protected void parseProcessResponseProcessResponseProcessNoteComponentProperties(JsonObject json, ProcessResponse owner, ProcessResponse.ProcessResponseProcessNoteComponent res) throws IOException, FHIRFormatError {
15432    parseBackboneProperties(json, res);
15433    if (json.has("type"))
15434      res.setType(parseCodeableConcept(getJObject(json, "type")));
15435    if (json.has("text"))
15436      res.setTextElement(parseString(json.get("text").getAsString()));
15437    if (json.has("_text"))
15438      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
15439  }
15440
15441  protected Provenance parseProvenance(JsonObject json) throws IOException, FHIRFormatError {
15442    Provenance res = new Provenance();
15443    parseProvenanceProperties(json, res);
15444    return res;
15445  }
15446
15447  protected void parseProvenanceProperties(JsonObject json, Provenance res) throws IOException, FHIRFormatError {
15448    parseDomainResourceProperties(json, res);
15449    if (json.has("target")) {
15450      JsonArray array = json.getAsJsonArray("target");
15451      for (int i = 0; i < array.size(); i++) {
15452        res.getTarget().add(parseReference(array.get(i).getAsJsonObject()));
15453      }
15454    };
15455    if (json.has("period"))
15456      res.setPeriod(parsePeriod(getJObject(json, "period")));
15457    if (json.has("recorded"))
15458      res.setRecordedElement(parseInstant(json.get("recorded").getAsString()));
15459    if (json.has("_recorded"))
15460      parseElementProperties(getJObject(json, "_recorded"), res.getRecordedElement());
15461    if (json.has("policy")) {
15462      JsonArray array = json.getAsJsonArray("policy");
15463      for (int i = 0; i < array.size(); i++) {
15464        if (array.get(i).isJsonNull()) {
15465          res.getPolicy().add(new UriType());
15466        } else {
15467          res.getPolicy().add(parseUri(array.get(i).getAsString()));
15468        }
15469      }
15470    };
15471    if (json.has("_policy")) {
15472      JsonArray array = json.getAsJsonArray("_policy");
15473      for (int i = 0; i < array.size(); i++) {
15474        if (i == res.getPolicy().size())
15475          res.getPolicy().add(parseUri(null));
15476        if (array.get(i) instanceof JsonObject) 
15477          parseElementProperties(array.get(i).getAsJsonObject(), res.getPolicy().get(i));
15478      }
15479    };
15480    if (json.has("location"))
15481      res.setLocation(parseReference(getJObject(json, "location")));
15482    if (json.has("reason")) {
15483      JsonArray array = json.getAsJsonArray("reason");
15484      for (int i = 0; i < array.size(); i++) {
15485        res.getReason().add(parseCoding(array.get(i).getAsJsonObject()));
15486      }
15487    };
15488    if (json.has("activity"))
15489      res.setActivity(parseCoding(getJObject(json, "activity")));
15490    if (json.has("agent")) {
15491      JsonArray array = json.getAsJsonArray("agent");
15492      for (int i = 0; i < array.size(); i++) {
15493        res.getAgent().add(parseProvenanceProvenanceAgentComponent(array.get(i).getAsJsonObject(), res));
15494      }
15495    };
15496    if (json.has("entity")) {
15497      JsonArray array = json.getAsJsonArray("entity");
15498      for (int i = 0; i < array.size(); i++) {
15499        res.getEntity().add(parseProvenanceProvenanceEntityComponent(array.get(i).getAsJsonObject(), res));
15500      }
15501    };
15502    if (json.has("signature")) {
15503      JsonArray array = json.getAsJsonArray("signature");
15504      for (int i = 0; i < array.size(); i++) {
15505        res.getSignature().add(parseSignature(array.get(i).getAsJsonObject()));
15506      }
15507    };
15508  }
15509
15510  protected Provenance.ProvenanceAgentComponent parseProvenanceProvenanceAgentComponent(JsonObject json, Provenance owner) throws IOException, FHIRFormatError {
15511    Provenance.ProvenanceAgentComponent res = new Provenance.ProvenanceAgentComponent();
15512    parseProvenanceProvenanceAgentComponentProperties(json, owner, res);
15513    return res;
15514  }
15515
15516  protected void parseProvenanceProvenanceAgentComponentProperties(JsonObject json, Provenance owner, Provenance.ProvenanceAgentComponent res) throws IOException, FHIRFormatError {
15517    parseBackboneProperties(json, res);
15518    if (json.has("role")) {
15519      JsonArray array = json.getAsJsonArray("role");
15520      for (int i = 0; i < array.size(); i++) {
15521        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15522      }
15523    };
15524    Type who = parseType("who", json);
15525    if (who != null)
15526      res.setWho(who);
15527    Type onBehalfOf = parseType("onBehalfOf", json);
15528    if (onBehalfOf != null)
15529      res.setOnBehalfOf(onBehalfOf);
15530    if (json.has("relatedAgentType"))
15531      res.setRelatedAgentType(parseCodeableConcept(getJObject(json, "relatedAgentType")));
15532  }
15533
15534  protected Provenance.ProvenanceEntityComponent parseProvenanceProvenanceEntityComponent(JsonObject json, Provenance owner) throws IOException, FHIRFormatError {
15535    Provenance.ProvenanceEntityComponent res = new Provenance.ProvenanceEntityComponent();
15536    parseProvenanceProvenanceEntityComponentProperties(json, owner, res);
15537    return res;
15538  }
15539
15540  protected void parseProvenanceProvenanceEntityComponentProperties(JsonObject json, Provenance owner, Provenance.ProvenanceEntityComponent res) throws IOException, FHIRFormatError {
15541    parseBackboneProperties(json, res);
15542    if (json.has("role"))
15543      res.setRoleElement(parseEnumeration(json.get("role").getAsString(), Provenance.ProvenanceEntityRole.NULL, new Provenance.ProvenanceEntityRoleEnumFactory()));
15544    if (json.has("_role"))
15545      parseElementProperties(getJObject(json, "_role"), res.getRoleElement());
15546    Type what = parseType("what", json);
15547    if (what != null)
15548      res.setWhat(what);
15549    if (json.has("agent")) {
15550      JsonArray array = json.getAsJsonArray("agent");
15551      for (int i = 0; i < array.size(); i++) {
15552        res.getAgent().add(parseProvenanceProvenanceAgentComponent(array.get(i).getAsJsonObject(), owner));
15553      }
15554    };
15555  }
15556
15557  protected Questionnaire parseQuestionnaire(JsonObject json) throws IOException, FHIRFormatError {
15558    Questionnaire res = new Questionnaire();
15559    parseQuestionnaireProperties(json, res);
15560    return res;
15561  }
15562
15563  protected void parseQuestionnaireProperties(JsonObject json, Questionnaire res) throws IOException, FHIRFormatError {
15564    parseDomainResourceProperties(json, res);
15565    if (json.has("url"))
15566      res.setUrlElement(parseUri(json.get("url").getAsString()));
15567    if (json.has("_url"))
15568      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
15569    if (json.has("identifier")) {
15570      JsonArray array = json.getAsJsonArray("identifier");
15571      for (int i = 0; i < array.size(); i++) {
15572        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15573      }
15574    };
15575    if (json.has("version"))
15576      res.setVersionElement(parseString(json.get("version").getAsString()));
15577    if (json.has("_version"))
15578      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
15579    if (json.has("name"))
15580      res.setNameElement(parseString(json.get("name").getAsString()));
15581    if (json.has("_name"))
15582      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
15583    if (json.has("title"))
15584      res.setTitleElement(parseString(json.get("title").getAsString()));
15585    if (json.has("_title"))
15586      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
15587    if (json.has("status"))
15588      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
15589    if (json.has("_status"))
15590      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
15591    if (json.has("experimental"))
15592      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
15593    if (json.has("_experimental"))
15594      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
15595    if (json.has("date"))
15596      res.setDateElement(parseDateTime(json.get("date").getAsString()));
15597    if (json.has("_date"))
15598      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
15599    if (json.has("publisher"))
15600      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
15601    if (json.has("_publisher"))
15602      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
15603    if (json.has("description"))
15604      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
15605    if (json.has("_description"))
15606      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
15607    if (json.has("purpose"))
15608      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
15609    if (json.has("_purpose"))
15610      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
15611    if (json.has("approvalDate"))
15612      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
15613    if (json.has("_approvalDate"))
15614      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
15615    if (json.has("lastReviewDate"))
15616      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
15617    if (json.has("_lastReviewDate"))
15618      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
15619    if (json.has("effectivePeriod"))
15620      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
15621    if (json.has("useContext")) {
15622      JsonArray array = json.getAsJsonArray("useContext");
15623      for (int i = 0; i < array.size(); i++) {
15624        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
15625      }
15626    };
15627    if (json.has("jurisdiction")) {
15628      JsonArray array = json.getAsJsonArray("jurisdiction");
15629      for (int i = 0; i < array.size(); i++) {
15630        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15631      }
15632    };
15633    if (json.has("contact")) {
15634      JsonArray array = json.getAsJsonArray("contact");
15635      for (int i = 0; i < array.size(); i++) {
15636        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
15637      }
15638    };
15639    if (json.has("copyright"))
15640      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
15641    if (json.has("_copyright"))
15642      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
15643    if (json.has("code")) {
15644      JsonArray array = json.getAsJsonArray("code");
15645      for (int i = 0; i < array.size(); i++) {
15646        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
15647      }
15648    };
15649    if (json.has("subjectType")) {
15650      JsonArray array = json.getAsJsonArray("subjectType");
15651      for (int i = 0; i < array.size(); i++) {
15652        if (array.get(i).isJsonNull()) {
15653          res.getSubjectType().add(new CodeType());
15654        } else {
15655          res.getSubjectType().add(parseCode(array.get(i).getAsString()));
15656        }
15657      }
15658    };
15659    if (json.has("_subjectType")) {
15660      JsonArray array = json.getAsJsonArray("_subjectType");
15661      for (int i = 0; i < array.size(); i++) {
15662        if (i == res.getSubjectType().size())
15663          res.getSubjectType().add(parseCode(null));
15664        if (array.get(i) instanceof JsonObject) 
15665          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubjectType().get(i));
15666      }
15667    };
15668    if (json.has("item")) {
15669      JsonArray array = json.getAsJsonArray("item");
15670      for (int i = 0; i < array.size(); i++) {
15671        res.getItem().add(parseQuestionnaireQuestionnaireItemComponent(array.get(i).getAsJsonObject(), res));
15672      }
15673    };
15674  }
15675
15676  protected Questionnaire.QuestionnaireItemComponent parseQuestionnaireQuestionnaireItemComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
15677    Questionnaire.QuestionnaireItemComponent res = new Questionnaire.QuestionnaireItemComponent();
15678    parseQuestionnaireQuestionnaireItemComponentProperties(json, owner, res);
15679    return res;
15680  }
15681
15682  protected void parseQuestionnaireQuestionnaireItemComponentProperties(JsonObject json, Questionnaire owner, Questionnaire.QuestionnaireItemComponent res) throws IOException, FHIRFormatError {
15683    parseBackboneProperties(json, res);
15684    if (json.has("linkId"))
15685      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
15686    if (json.has("_linkId"))
15687      parseElementProperties(getJObject(json, "_linkId"), res.getLinkIdElement());
15688    if (json.has("definition"))
15689      res.setDefinitionElement(parseUri(json.get("definition").getAsString()));
15690    if (json.has("_definition"))
15691      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
15692    if (json.has("code")) {
15693      JsonArray array = json.getAsJsonArray("code");
15694      for (int i = 0; i < array.size(); i++) {
15695        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
15696      }
15697    };
15698    if (json.has("prefix"))
15699      res.setPrefixElement(parseString(json.get("prefix").getAsString()));
15700    if (json.has("_prefix"))
15701      parseElementProperties(getJObject(json, "_prefix"), res.getPrefixElement());
15702    if (json.has("text"))
15703      res.setTextElement(parseString(json.get("text").getAsString()));
15704    if (json.has("_text"))
15705      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
15706    if (json.has("type"))
15707      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Questionnaire.QuestionnaireItemType.NULL, new Questionnaire.QuestionnaireItemTypeEnumFactory()));
15708    if (json.has("_type"))
15709      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
15710    if (json.has("enableWhen")) {
15711      JsonArray array = json.getAsJsonArray("enableWhen");
15712      for (int i = 0; i < array.size(); i++) {
15713        res.getEnableWhen().add(parseQuestionnaireQuestionnaireItemEnableWhenComponent(array.get(i).getAsJsonObject(), owner));
15714      }
15715    };
15716    if (json.has("required"))
15717      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
15718    if (json.has("_required"))
15719      parseElementProperties(getJObject(json, "_required"), res.getRequiredElement());
15720    if (json.has("repeats"))
15721      res.setRepeatsElement(parseBoolean(json.get("repeats").getAsBoolean()));
15722    if (json.has("_repeats"))
15723      parseElementProperties(getJObject(json, "_repeats"), res.getRepeatsElement());
15724    if (json.has("readOnly"))
15725      res.setReadOnlyElement(parseBoolean(json.get("readOnly").getAsBoolean()));
15726    if (json.has("_readOnly"))
15727      parseElementProperties(getJObject(json, "_readOnly"), res.getReadOnlyElement());
15728    if (json.has("maxLength"))
15729      res.setMaxLengthElement(parseInteger(json.get("maxLength").getAsLong()));
15730    if (json.has("_maxLength"))
15731      parseElementProperties(getJObject(json, "_maxLength"), res.getMaxLengthElement());
15732    if (json.has("options"))
15733      res.setOptions(parseReference(getJObject(json, "options")));
15734    if (json.has("option")) {
15735      JsonArray array = json.getAsJsonArray("option");
15736      for (int i = 0; i < array.size(); i++) {
15737        res.getOption().add(parseQuestionnaireQuestionnaireItemOptionComponent(array.get(i).getAsJsonObject(), owner));
15738      }
15739    };
15740    Type initial = parseType("initial", json);
15741    if (initial != null)
15742      res.setInitial(initial);
15743    if (json.has("item")) {
15744      JsonArray array = json.getAsJsonArray("item");
15745      for (int i = 0; i < array.size(); i++) {
15746        res.getItem().add(parseQuestionnaireQuestionnaireItemComponent(array.get(i).getAsJsonObject(), owner));
15747      }
15748    };
15749  }
15750
15751  protected Questionnaire.QuestionnaireItemEnableWhenComponent parseQuestionnaireQuestionnaireItemEnableWhenComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
15752    Questionnaire.QuestionnaireItemEnableWhenComponent res = new Questionnaire.QuestionnaireItemEnableWhenComponent();
15753    parseQuestionnaireQuestionnaireItemEnableWhenComponentProperties(json, owner, res);
15754    return res;
15755  }
15756
15757  protected void parseQuestionnaireQuestionnaireItemEnableWhenComponentProperties(JsonObject json, Questionnaire owner, Questionnaire.QuestionnaireItemEnableWhenComponent res) throws IOException, FHIRFormatError {
15758    parseBackboneProperties(json, res);
15759    if (json.has("question"))
15760      res.setQuestionElement(parseString(json.get("question").getAsString()));
15761    if (json.has("_question"))
15762      parseElementProperties(getJObject(json, "_question"), res.getQuestionElement());
15763    if (json.has("hasAnswer"))
15764      res.setHasAnswerElement(parseBoolean(json.get("hasAnswer").getAsBoolean()));
15765    if (json.has("_hasAnswer"))
15766      parseElementProperties(getJObject(json, "_hasAnswer"), res.getHasAnswerElement());
15767    Type answer = parseType("answer", json);
15768    if (answer != null)
15769      res.setAnswer(answer);
15770  }
15771
15772  protected Questionnaire.QuestionnaireItemOptionComponent parseQuestionnaireQuestionnaireItemOptionComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
15773    Questionnaire.QuestionnaireItemOptionComponent res = new Questionnaire.QuestionnaireItemOptionComponent();
15774    parseQuestionnaireQuestionnaireItemOptionComponentProperties(json, owner, res);
15775    return res;
15776  }
15777
15778  protected void parseQuestionnaireQuestionnaireItemOptionComponentProperties(JsonObject json, Questionnaire owner, Questionnaire.QuestionnaireItemOptionComponent res) throws IOException, FHIRFormatError {
15779    parseBackboneProperties(json, res);
15780    Type value = parseType("value", json);
15781    if (value != null)
15782      res.setValue(value);
15783  }
15784
15785  protected QuestionnaireResponse parseQuestionnaireResponse(JsonObject json) throws IOException, FHIRFormatError {
15786    QuestionnaireResponse res = new QuestionnaireResponse();
15787    parseQuestionnaireResponseProperties(json, res);
15788    return res;
15789  }
15790
15791  protected void parseQuestionnaireResponseProperties(JsonObject json, QuestionnaireResponse res) throws IOException, FHIRFormatError {
15792    parseDomainResourceProperties(json, res);
15793    if (json.has("identifier"))
15794      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
15795    if (json.has("basedOn")) {
15796      JsonArray array = json.getAsJsonArray("basedOn");
15797      for (int i = 0; i < array.size(); i++) {
15798        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
15799      }
15800    };
15801    if (json.has("parent")) {
15802      JsonArray array = json.getAsJsonArray("parent");
15803      for (int i = 0; i < array.size(); i++) {
15804        res.getParent().add(parseReference(array.get(i).getAsJsonObject()));
15805      }
15806    };
15807    if (json.has("questionnaire"))
15808      res.setQuestionnaire(parseReference(getJObject(json, "questionnaire")));
15809    if (json.has("status"))
15810      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), QuestionnaireResponse.QuestionnaireResponseStatus.NULL, new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory()));
15811    if (json.has("_status"))
15812      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
15813    if (json.has("subject"))
15814      res.setSubject(parseReference(getJObject(json, "subject")));
15815    if (json.has("context"))
15816      res.setContext(parseReference(getJObject(json, "context")));
15817    if (json.has("authored"))
15818      res.setAuthoredElement(parseDateTime(json.get("authored").getAsString()));
15819    if (json.has("_authored"))
15820      parseElementProperties(getJObject(json, "_authored"), res.getAuthoredElement());
15821    if (json.has("author"))
15822      res.setAuthor(parseReference(getJObject(json, "author")));
15823    if (json.has("source"))
15824      res.setSource(parseReference(getJObject(json, "source")));
15825    if (json.has("item")) {
15826      JsonArray array = json.getAsJsonArray("item");
15827      for (int i = 0; i < array.size(); i++) {
15828        res.getItem().add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject(), res));
15829      }
15830    };
15831  }
15832
15833  protected QuestionnaireResponse.QuestionnaireResponseItemComponent parseQuestionnaireResponseQuestionnaireResponseItemComponent(JsonObject json, QuestionnaireResponse owner) throws IOException, FHIRFormatError {
15834    QuestionnaireResponse.QuestionnaireResponseItemComponent res = new QuestionnaireResponse.QuestionnaireResponseItemComponent();
15835    parseQuestionnaireResponseQuestionnaireResponseItemComponentProperties(json, owner, res);
15836    return res;
15837  }
15838
15839  protected void parseQuestionnaireResponseQuestionnaireResponseItemComponentProperties(JsonObject json, QuestionnaireResponse owner, QuestionnaireResponse.QuestionnaireResponseItemComponent res) throws IOException, FHIRFormatError {
15840    parseBackboneProperties(json, res);
15841    if (json.has("linkId"))
15842      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
15843    if (json.has("_linkId"))
15844      parseElementProperties(getJObject(json, "_linkId"), res.getLinkIdElement());
15845    if (json.has("definition"))
15846      res.setDefinitionElement(parseUri(json.get("definition").getAsString()));
15847    if (json.has("_definition"))
15848      parseElementProperties(getJObject(json, "_definition"), res.getDefinitionElement());
15849    if (json.has("text"))
15850      res.setTextElement(parseString(json.get("text").getAsString()));
15851    if (json.has("_text"))
15852      parseElementProperties(getJObject(json, "_text"), res.getTextElement());
15853    if (json.has("subject"))
15854      res.setSubject(parseReference(getJObject(json, "subject")));
15855    if (json.has("answer")) {
15856      JsonArray array = json.getAsJsonArray("answer");
15857      for (int i = 0; i < array.size(); i++) {
15858        res.getAnswer().add(parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(array.get(i).getAsJsonObject(), owner));
15859      }
15860    };
15861    if (json.has("item")) {
15862      JsonArray array = json.getAsJsonArray("item");
15863      for (int i = 0; i < array.size(); i++) {
15864        res.getItem().add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject(), owner));
15865      }
15866    };
15867  }
15868
15869  protected QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(JsonObject json, QuestionnaireResponse owner) throws IOException, FHIRFormatError {
15870    QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent res = new QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent();
15871    parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponentProperties(json, owner, res);
15872    return res;
15873  }
15874
15875  protected void parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponentProperties(JsonObject json, QuestionnaireResponse owner, QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent res) throws IOException, FHIRFormatError {
15876    parseBackboneProperties(json, res);
15877    Type value = parseType("value", json);
15878    if (value != null)
15879      res.setValue(value);
15880    if (json.has("item")) {
15881      JsonArray array = json.getAsJsonArray("item");
15882      for (int i = 0; i < array.size(); i++) {
15883        res.getItem().add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject(), owner));
15884      }
15885    };
15886  }
15887
15888  protected ReferralRequest parseReferralRequest(JsonObject json) throws IOException, FHIRFormatError {
15889    ReferralRequest res = new ReferralRequest();
15890    parseReferralRequestProperties(json, res);
15891    return res;
15892  }
15893
15894  protected void parseReferralRequestProperties(JsonObject json, ReferralRequest res) throws IOException, FHIRFormatError {
15895    parseDomainResourceProperties(json, res);
15896    if (json.has("identifier")) {
15897      JsonArray array = json.getAsJsonArray("identifier");
15898      for (int i = 0; i < array.size(); i++) {
15899        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15900      }
15901    };
15902    if (json.has("definition")) {
15903      JsonArray array = json.getAsJsonArray("definition");
15904      for (int i = 0; i < array.size(); i++) {
15905        res.getDefinition().add(parseReference(array.get(i).getAsJsonObject()));
15906      }
15907    };
15908    if (json.has("basedOn")) {
15909      JsonArray array = json.getAsJsonArray("basedOn");
15910      for (int i = 0; i < array.size(); i++) {
15911        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
15912      }
15913    };
15914    if (json.has("replaces")) {
15915      JsonArray array = json.getAsJsonArray("replaces");
15916      for (int i = 0; i < array.size(); i++) {
15917        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
15918      }
15919    };
15920    if (json.has("groupIdentifier"))
15921      res.setGroupIdentifier(parseIdentifier(getJObject(json, "groupIdentifier")));
15922    if (json.has("status"))
15923      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ReferralRequest.ReferralRequestStatus.NULL, new ReferralRequest.ReferralRequestStatusEnumFactory()));
15924    if (json.has("_status"))
15925      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
15926    if (json.has("intent"))
15927      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), ReferralRequest.ReferralCategory.NULL, new ReferralRequest.ReferralCategoryEnumFactory()));
15928    if (json.has("_intent"))
15929      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
15930    if (json.has("type"))
15931      res.setType(parseCodeableConcept(getJObject(json, "type")));
15932    if (json.has("priority"))
15933      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), ReferralRequest.ReferralPriority.NULL, new ReferralRequest.ReferralPriorityEnumFactory()));
15934    if (json.has("_priority"))
15935      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
15936    if (json.has("serviceRequested")) {
15937      JsonArray array = json.getAsJsonArray("serviceRequested");
15938      for (int i = 0; i < array.size(); i++) {
15939        res.getServiceRequested().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15940      }
15941    };
15942    if (json.has("subject"))
15943      res.setSubject(parseReference(getJObject(json, "subject")));
15944    if (json.has("context"))
15945      res.setContext(parseReference(getJObject(json, "context")));
15946    Type occurrence = parseType("occurrence", json);
15947    if (occurrence != null)
15948      res.setOccurrence(occurrence);
15949    if (json.has("authoredOn"))
15950      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
15951    if (json.has("_authoredOn"))
15952      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
15953    if (json.has("requester"))
15954      res.setRequester(parseReferralRequestReferralRequestRequesterComponent(getJObject(json, "requester"), res));
15955    if (json.has("specialty"))
15956      res.setSpecialty(parseCodeableConcept(getJObject(json, "specialty")));
15957    if (json.has("recipient")) {
15958      JsonArray array = json.getAsJsonArray("recipient");
15959      for (int i = 0; i < array.size(); i++) {
15960        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
15961      }
15962    };
15963    if (json.has("reasonCode")) {
15964      JsonArray array = json.getAsJsonArray("reasonCode");
15965      for (int i = 0; i < array.size(); i++) {
15966        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15967      }
15968    };
15969    if (json.has("reasonReference")) {
15970      JsonArray array = json.getAsJsonArray("reasonReference");
15971      for (int i = 0; i < array.size(); i++) {
15972        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
15973      }
15974    };
15975    if (json.has("description"))
15976      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15977    if (json.has("_description"))
15978      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
15979    if (json.has("supportingInfo")) {
15980      JsonArray array = json.getAsJsonArray("supportingInfo");
15981      for (int i = 0; i < array.size(); i++) {
15982        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
15983      }
15984    };
15985    if (json.has("note")) {
15986      JsonArray array = json.getAsJsonArray("note");
15987      for (int i = 0; i < array.size(); i++) {
15988        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
15989      }
15990    };
15991    if (json.has("relevantHistory")) {
15992      JsonArray array = json.getAsJsonArray("relevantHistory");
15993      for (int i = 0; i < array.size(); i++) {
15994        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
15995      }
15996    };
15997  }
15998
15999  protected ReferralRequest.ReferralRequestRequesterComponent parseReferralRequestReferralRequestRequesterComponent(JsonObject json, ReferralRequest owner) throws IOException, FHIRFormatError {
16000    ReferralRequest.ReferralRequestRequesterComponent res = new ReferralRequest.ReferralRequestRequesterComponent();
16001    parseReferralRequestReferralRequestRequesterComponentProperties(json, owner, res);
16002    return res;
16003  }
16004
16005  protected void parseReferralRequestReferralRequestRequesterComponentProperties(JsonObject json, ReferralRequest owner, ReferralRequest.ReferralRequestRequesterComponent res) throws IOException, FHIRFormatError {
16006    parseBackboneProperties(json, res);
16007    if (json.has("agent"))
16008      res.setAgent(parseReference(getJObject(json, "agent")));
16009    if (json.has("onBehalfOf"))
16010      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
16011  }
16012
16013  protected RelatedPerson parseRelatedPerson(JsonObject json) throws IOException, FHIRFormatError {
16014    RelatedPerson res = new RelatedPerson();
16015    parseRelatedPersonProperties(json, res);
16016    return res;
16017  }
16018
16019  protected void parseRelatedPersonProperties(JsonObject json, RelatedPerson res) throws IOException, FHIRFormatError {
16020    parseDomainResourceProperties(json, res);
16021    if (json.has("identifier")) {
16022      JsonArray array = json.getAsJsonArray("identifier");
16023      for (int i = 0; i < array.size(); i++) {
16024        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16025      }
16026    };
16027    if (json.has("active"))
16028      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
16029    if (json.has("_active"))
16030      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
16031    if (json.has("patient"))
16032      res.setPatient(parseReference(getJObject(json, "patient")));
16033    if (json.has("relationship"))
16034      res.setRelationship(parseCodeableConcept(getJObject(json, "relationship")));
16035    if (json.has("name")) {
16036      JsonArray array = json.getAsJsonArray("name");
16037      for (int i = 0; i < array.size(); i++) {
16038        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
16039      }
16040    };
16041    if (json.has("telecom")) {
16042      JsonArray array = json.getAsJsonArray("telecom");
16043      for (int i = 0; i < array.size(); i++) {
16044        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
16045      }
16046    };
16047    if (json.has("gender"))
16048      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
16049    if (json.has("_gender"))
16050      parseElementProperties(getJObject(json, "_gender"), res.getGenderElement());
16051    if (json.has("birthDate"))
16052      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
16053    if (json.has("_birthDate"))
16054      parseElementProperties(getJObject(json, "_birthDate"), res.getBirthDateElement());
16055    if (json.has("address")) {
16056      JsonArray array = json.getAsJsonArray("address");
16057      for (int i = 0; i < array.size(); i++) {
16058        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
16059      }
16060    };
16061    if (json.has("photo")) {
16062      JsonArray array = json.getAsJsonArray("photo");
16063      for (int i = 0; i < array.size(); i++) {
16064        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
16065      }
16066    };
16067    if (json.has("period"))
16068      res.setPeriod(parsePeriod(getJObject(json, "period")));
16069  }
16070
16071  protected RequestGroup parseRequestGroup(JsonObject json) throws IOException, FHIRFormatError {
16072    RequestGroup res = new RequestGroup();
16073    parseRequestGroupProperties(json, res);
16074    return res;
16075  }
16076
16077  protected void parseRequestGroupProperties(JsonObject json, RequestGroup res) throws IOException, FHIRFormatError {
16078    parseDomainResourceProperties(json, res);
16079    if (json.has("identifier")) {
16080      JsonArray array = json.getAsJsonArray("identifier");
16081      for (int i = 0; i < array.size(); i++) {
16082        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16083      }
16084    };
16085    if (json.has("definition")) {
16086      JsonArray array = json.getAsJsonArray("definition");
16087      for (int i = 0; i < array.size(); i++) {
16088        res.getDefinition().add(parseReference(array.get(i).getAsJsonObject()));
16089      }
16090    };
16091    if (json.has("basedOn")) {
16092      JsonArray array = json.getAsJsonArray("basedOn");
16093      for (int i = 0; i < array.size(); i++) {
16094        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
16095      }
16096    };
16097    if (json.has("replaces")) {
16098      JsonArray array = json.getAsJsonArray("replaces");
16099      for (int i = 0; i < array.size(); i++) {
16100        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
16101      }
16102    };
16103    if (json.has("groupIdentifier"))
16104      res.setGroupIdentifier(parseIdentifier(getJObject(json, "groupIdentifier")));
16105    if (json.has("status"))
16106      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), RequestGroup.RequestStatus.NULL, new RequestGroup.RequestStatusEnumFactory()));
16107    if (json.has("_status"))
16108      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
16109    if (json.has("intent"))
16110      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), RequestGroup.RequestIntent.NULL, new RequestGroup.RequestIntentEnumFactory()));
16111    if (json.has("_intent"))
16112      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
16113    if (json.has("priority"))
16114      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), RequestGroup.RequestPriority.NULL, new RequestGroup.RequestPriorityEnumFactory()));
16115    if (json.has("_priority"))
16116      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
16117    if (json.has("subject"))
16118      res.setSubject(parseReference(getJObject(json, "subject")));
16119    if (json.has("context"))
16120      res.setContext(parseReference(getJObject(json, "context")));
16121    if (json.has("authoredOn"))
16122      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
16123    if (json.has("_authoredOn"))
16124      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
16125    if (json.has("author"))
16126      res.setAuthor(parseReference(getJObject(json, "author")));
16127    Type reason = parseType("reason", json);
16128    if (reason != null)
16129      res.setReason(reason);
16130    if (json.has("note")) {
16131      JsonArray array = json.getAsJsonArray("note");
16132      for (int i = 0; i < array.size(); i++) {
16133        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
16134      }
16135    };
16136    if (json.has("action")) {
16137      JsonArray array = json.getAsJsonArray("action");
16138      for (int i = 0; i < array.size(); i++) {
16139        res.getAction().add(parseRequestGroupRequestGroupActionComponent(array.get(i).getAsJsonObject(), res));
16140      }
16141    };
16142  }
16143
16144  protected RequestGroup.RequestGroupActionComponent parseRequestGroupRequestGroupActionComponent(JsonObject json, RequestGroup owner) throws IOException, FHIRFormatError {
16145    RequestGroup.RequestGroupActionComponent res = new RequestGroup.RequestGroupActionComponent();
16146    parseRequestGroupRequestGroupActionComponentProperties(json, owner, res);
16147    return res;
16148  }
16149
16150  protected void parseRequestGroupRequestGroupActionComponentProperties(JsonObject json, RequestGroup owner, RequestGroup.RequestGroupActionComponent res) throws IOException, FHIRFormatError {
16151    parseBackboneProperties(json, res);
16152    if (json.has("label"))
16153      res.setLabelElement(parseString(json.get("label").getAsString()));
16154    if (json.has("_label"))
16155      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
16156    if (json.has("title"))
16157      res.setTitleElement(parseString(json.get("title").getAsString()));
16158    if (json.has("_title"))
16159      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
16160    if (json.has("description"))
16161      res.setDescriptionElement(parseString(json.get("description").getAsString()));
16162    if (json.has("_description"))
16163      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
16164    if (json.has("textEquivalent"))
16165      res.setTextEquivalentElement(parseString(json.get("textEquivalent").getAsString()));
16166    if (json.has("_textEquivalent"))
16167      parseElementProperties(getJObject(json, "_textEquivalent"), res.getTextEquivalentElement());
16168    if (json.has("code")) {
16169      JsonArray array = json.getAsJsonArray("code");
16170      for (int i = 0; i < array.size(); i++) {
16171        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16172      }
16173    };
16174    if (json.has("documentation")) {
16175      JsonArray array = json.getAsJsonArray("documentation");
16176      for (int i = 0; i < array.size(); i++) {
16177        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
16178      }
16179    };
16180    if (json.has("condition")) {
16181      JsonArray array = json.getAsJsonArray("condition");
16182      for (int i = 0; i < array.size(); i++) {
16183        res.getCondition().add(parseRequestGroupRequestGroupActionConditionComponent(array.get(i).getAsJsonObject(), owner));
16184      }
16185    };
16186    if (json.has("relatedAction")) {
16187      JsonArray array = json.getAsJsonArray("relatedAction");
16188      for (int i = 0; i < array.size(); i++) {
16189        res.getRelatedAction().add(parseRequestGroupRequestGroupActionRelatedActionComponent(array.get(i).getAsJsonObject(), owner));
16190      }
16191    };
16192    Type timing = parseType("timing", json);
16193    if (timing != null)
16194      res.setTiming(timing);
16195    if (json.has("participant")) {
16196      JsonArray array = json.getAsJsonArray("participant");
16197      for (int i = 0; i < array.size(); i++) {
16198        res.getParticipant().add(parseReference(array.get(i).getAsJsonObject()));
16199      }
16200    };
16201    if (json.has("type"))
16202      res.setType(parseCoding(getJObject(json, "type")));
16203    if (json.has("groupingBehavior"))
16204      res.setGroupingBehaviorElement(parseEnumeration(json.get("groupingBehavior").getAsString(), RequestGroup.ActionGroupingBehavior.NULL, new RequestGroup.ActionGroupingBehaviorEnumFactory()));
16205    if (json.has("_groupingBehavior"))
16206      parseElementProperties(getJObject(json, "_groupingBehavior"), res.getGroupingBehaviorElement());
16207    if (json.has("selectionBehavior"))
16208      res.setSelectionBehaviorElement(parseEnumeration(json.get("selectionBehavior").getAsString(), RequestGroup.ActionSelectionBehavior.NULL, new RequestGroup.ActionSelectionBehaviorEnumFactory()));
16209    if (json.has("_selectionBehavior"))
16210      parseElementProperties(getJObject(json, "_selectionBehavior"), res.getSelectionBehaviorElement());
16211    if (json.has("requiredBehavior"))
16212      res.setRequiredBehaviorElement(parseEnumeration(json.get("requiredBehavior").getAsString(), RequestGroup.ActionRequiredBehavior.NULL, new RequestGroup.ActionRequiredBehaviorEnumFactory()));
16213    if (json.has("_requiredBehavior"))
16214      parseElementProperties(getJObject(json, "_requiredBehavior"), res.getRequiredBehaviorElement());
16215    if (json.has("precheckBehavior"))
16216      res.setPrecheckBehaviorElement(parseEnumeration(json.get("precheckBehavior").getAsString(), RequestGroup.ActionPrecheckBehavior.NULL, new RequestGroup.ActionPrecheckBehaviorEnumFactory()));
16217    if (json.has("_precheckBehavior"))
16218      parseElementProperties(getJObject(json, "_precheckBehavior"), res.getPrecheckBehaviorElement());
16219    if (json.has("cardinalityBehavior"))
16220      res.setCardinalityBehaviorElement(parseEnumeration(json.get("cardinalityBehavior").getAsString(), RequestGroup.ActionCardinalityBehavior.NULL, new RequestGroup.ActionCardinalityBehaviorEnumFactory()));
16221    if (json.has("_cardinalityBehavior"))
16222      parseElementProperties(getJObject(json, "_cardinalityBehavior"), res.getCardinalityBehaviorElement());
16223    if (json.has("resource"))
16224      res.setResource(parseReference(getJObject(json, "resource")));
16225    if (json.has("action")) {
16226      JsonArray array = json.getAsJsonArray("action");
16227      for (int i = 0; i < array.size(); i++) {
16228        res.getAction().add(parseRequestGroupRequestGroupActionComponent(array.get(i).getAsJsonObject(), owner));
16229      }
16230    };
16231  }
16232
16233  protected RequestGroup.RequestGroupActionConditionComponent parseRequestGroupRequestGroupActionConditionComponent(JsonObject json, RequestGroup owner) throws IOException, FHIRFormatError {
16234    RequestGroup.RequestGroupActionConditionComponent res = new RequestGroup.RequestGroupActionConditionComponent();
16235    parseRequestGroupRequestGroupActionConditionComponentProperties(json, owner, res);
16236    return res;
16237  }
16238
16239  protected void parseRequestGroupRequestGroupActionConditionComponentProperties(JsonObject json, RequestGroup owner, RequestGroup.RequestGroupActionConditionComponent res) throws IOException, FHIRFormatError {
16240    parseBackboneProperties(json, res);
16241    if (json.has("kind"))
16242      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), RequestGroup.ActionConditionKind.NULL, new RequestGroup.ActionConditionKindEnumFactory()));
16243    if (json.has("_kind"))
16244      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
16245    if (json.has("description"))
16246      res.setDescriptionElement(parseString(json.get("description").getAsString()));
16247    if (json.has("_description"))
16248      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
16249    if (json.has("language"))
16250      res.setLanguageElement(parseString(json.get("language").getAsString()));
16251    if (json.has("_language"))
16252      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
16253    if (json.has("expression"))
16254      res.setExpressionElement(parseString(json.get("expression").getAsString()));
16255    if (json.has("_expression"))
16256      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
16257  }
16258
16259  protected RequestGroup.RequestGroupActionRelatedActionComponent parseRequestGroupRequestGroupActionRelatedActionComponent(JsonObject json, RequestGroup owner) throws IOException, FHIRFormatError {
16260    RequestGroup.RequestGroupActionRelatedActionComponent res = new RequestGroup.RequestGroupActionRelatedActionComponent();
16261    parseRequestGroupRequestGroupActionRelatedActionComponentProperties(json, owner, res);
16262    return res;
16263  }
16264
16265  protected void parseRequestGroupRequestGroupActionRelatedActionComponentProperties(JsonObject json, RequestGroup owner, RequestGroup.RequestGroupActionRelatedActionComponent res) throws IOException, FHIRFormatError {
16266    parseBackboneProperties(json, res);
16267    if (json.has("actionId"))
16268      res.setActionIdElement(parseId(json.get("actionId").getAsString()));
16269    if (json.has("_actionId"))
16270      parseElementProperties(getJObject(json, "_actionId"), res.getActionIdElement());
16271    if (json.has("relationship"))
16272      res.setRelationshipElement(parseEnumeration(json.get("relationship").getAsString(), RequestGroup.ActionRelationshipType.NULL, new RequestGroup.ActionRelationshipTypeEnumFactory()));
16273    if (json.has("_relationship"))
16274      parseElementProperties(getJObject(json, "_relationship"), res.getRelationshipElement());
16275    Type offset = parseType("offset", json);
16276    if (offset != null)
16277      res.setOffset(offset);
16278  }
16279
16280  protected ResearchStudy parseResearchStudy(JsonObject json) throws IOException, FHIRFormatError {
16281    ResearchStudy res = new ResearchStudy();
16282    parseResearchStudyProperties(json, res);
16283    return res;
16284  }
16285
16286  protected void parseResearchStudyProperties(JsonObject json, ResearchStudy res) throws IOException, FHIRFormatError {
16287    parseDomainResourceProperties(json, res);
16288    if (json.has("identifier")) {
16289      JsonArray array = json.getAsJsonArray("identifier");
16290      for (int i = 0; i < array.size(); i++) {
16291        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16292      }
16293    };
16294    if (json.has("title"))
16295      res.setTitleElement(parseString(json.get("title").getAsString()));
16296    if (json.has("_title"))
16297      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
16298    if (json.has("protocol")) {
16299      JsonArray array = json.getAsJsonArray("protocol");
16300      for (int i = 0; i < array.size(); i++) {
16301        res.getProtocol().add(parseReference(array.get(i).getAsJsonObject()));
16302      }
16303    };
16304    if (json.has("partOf")) {
16305      JsonArray array = json.getAsJsonArray("partOf");
16306      for (int i = 0; i < array.size(); i++) {
16307        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
16308      }
16309    };
16310    if (json.has("status"))
16311      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ResearchStudy.ResearchStudyStatus.NULL, new ResearchStudy.ResearchStudyStatusEnumFactory()));
16312    if (json.has("_status"))
16313      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
16314    if (json.has("category")) {
16315      JsonArray array = json.getAsJsonArray("category");
16316      for (int i = 0; i < array.size(); i++) {
16317        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16318      }
16319    };
16320    if (json.has("focus")) {
16321      JsonArray array = json.getAsJsonArray("focus");
16322      for (int i = 0; i < array.size(); i++) {
16323        res.getFocus().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16324      }
16325    };
16326    if (json.has("contact")) {
16327      JsonArray array = json.getAsJsonArray("contact");
16328      for (int i = 0; i < array.size(); i++) {
16329        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
16330      }
16331    };
16332    if (json.has("relatedArtifact")) {
16333      JsonArray array = json.getAsJsonArray("relatedArtifact");
16334      for (int i = 0; i < array.size(); i++) {
16335        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
16336      }
16337    };
16338    if (json.has("keyword")) {
16339      JsonArray array = json.getAsJsonArray("keyword");
16340      for (int i = 0; i < array.size(); i++) {
16341        res.getKeyword().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16342      }
16343    };
16344    if (json.has("jurisdiction")) {
16345      JsonArray array = json.getAsJsonArray("jurisdiction");
16346      for (int i = 0; i < array.size(); i++) {
16347        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16348      }
16349    };
16350    if (json.has("description"))
16351      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
16352    if (json.has("_description"))
16353      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
16354    if (json.has("enrollment")) {
16355      JsonArray array = json.getAsJsonArray("enrollment");
16356      for (int i = 0; i < array.size(); i++) {
16357        res.getEnrollment().add(parseReference(array.get(i).getAsJsonObject()));
16358      }
16359    };
16360    if (json.has("period"))
16361      res.setPeriod(parsePeriod(getJObject(json, "period")));
16362    if (json.has("sponsor"))
16363      res.setSponsor(parseReference(getJObject(json, "sponsor")));
16364    if (json.has("principalInvestigator"))
16365      res.setPrincipalInvestigator(parseReference(getJObject(json, "principalInvestigator")));
16366    if (json.has("site")) {
16367      JsonArray array = json.getAsJsonArray("site");
16368      for (int i = 0; i < array.size(); i++) {
16369        res.getSite().add(parseReference(array.get(i).getAsJsonObject()));
16370      }
16371    };
16372    if (json.has("reasonStopped"))
16373      res.setReasonStopped(parseCodeableConcept(getJObject(json, "reasonStopped")));
16374    if (json.has("note")) {
16375      JsonArray array = json.getAsJsonArray("note");
16376      for (int i = 0; i < array.size(); i++) {
16377        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
16378      }
16379    };
16380    if (json.has("arm")) {
16381      JsonArray array = json.getAsJsonArray("arm");
16382      for (int i = 0; i < array.size(); i++) {
16383        res.getArm().add(parseResearchStudyResearchStudyArmComponent(array.get(i).getAsJsonObject(), res));
16384      }
16385    };
16386  }
16387
16388  protected ResearchStudy.ResearchStudyArmComponent parseResearchStudyResearchStudyArmComponent(JsonObject json, ResearchStudy owner) throws IOException, FHIRFormatError {
16389    ResearchStudy.ResearchStudyArmComponent res = new ResearchStudy.ResearchStudyArmComponent();
16390    parseResearchStudyResearchStudyArmComponentProperties(json, owner, res);
16391    return res;
16392  }
16393
16394  protected void parseResearchStudyResearchStudyArmComponentProperties(JsonObject json, ResearchStudy owner, ResearchStudy.ResearchStudyArmComponent res) throws IOException, FHIRFormatError {
16395    parseBackboneProperties(json, res);
16396    if (json.has("name"))
16397      res.setNameElement(parseString(json.get("name").getAsString()));
16398    if (json.has("_name"))
16399      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
16400    if (json.has("code"))
16401      res.setCode(parseCodeableConcept(getJObject(json, "code")));
16402    if (json.has("description"))
16403      res.setDescriptionElement(parseString(json.get("description").getAsString()));
16404    if (json.has("_description"))
16405      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
16406  }
16407
16408  protected ResearchSubject parseResearchSubject(JsonObject json) throws IOException, FHIRFormatError {
16409    ResearchSubject res = new ResearchSubject();
16410    parseResearchSubjectProperties(json, res);
16411    return res;
16412  }
16413
16414  protected void parseResearchSubjectProperties(JsonObject json, ResearchSubject res) throws IOException, FHIRFormatError {
16415    parseDomainResourceProperties(json, res);
16416    if (json.has("identifier"))
16417      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
16418    if (json.has("status"))
16419      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ResearchSubject.ResearchSubjectStatus.NULL, new ResearchSubject.ResearchSubjectStatusEnumFactory()));
16420    if (json.has("_status"))
16421      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
16422    if (json.has("period"))
16423      res.setPeriod(parsePeriod(getJObject(json, "period")));
16424    if (json.has("study"))
16425      res.setStudy(parseReference(getJObject(json, "study")));
16426    if (json.has("individual"))
16427      res.setIndividual(parseReference(getJObject(json, "individual")));
16428    if (json.has("assignedArm"))
16429      res.setAssignedArmElement(parseString(json.get("assignedArm").getAsString()));
16430    if (json.has("_assignedArm"))
16431      parseElementProperties(getJObject(json, "_assignedArm"), res.getAssignedArmElement());
16432    if (json.has("actualArm"))
16433      res.setActualArmElement(parseString(json.get("actualArm").getAsString()));
16434    if (json.has("_actualArm"))
16435      parseElementProperties(getJObject(json, "_actualArm"), res.getActualArmElement());
16436    if (json.has("consent"))
16437      res.setConsent(parseReference(getJObject(json, "consent")));
16438  }
16439
16440  protected RiskAssessment parseRiskAssessment(JsonObject json) throws IOException, FHIRFormatError {
16441    RiskAssessment res = new RiskAssessment();
16442    parseRiskAssessmentProperties(json, res);
16443    return res;
16444  }
16445
16446  protected void parseRiskAssessmentProperties(JsonObject json, RiskAssessment res) throws IOException, FHIRFormatError {
16447    parseDomainResourceProperties(json, res);
16448    if (json.has("identifier"))
16449      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
16450    if (json.has("basedOn"))
16451      res.setBasedOn(parseReference(getJObject(json, "basedOn")));
16452    if (json.has("parent"))
16453      res.setParent(parseReference(getJObject(json, "parent")));
16454    if (json.has("status"))
16455      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), RiskAssessment.RiskAssessmentStatus.NULL, new RiskAssessment.RiskAssessmentStatusEnumFactory()));
16456    if (json.has("_status"))
16457      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
16458    if (json.has("method"))
16459      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
16460    if (json.has("code"))
16461      res.setCode(parseCodeableConcept(getJObject(json, "code")));
16462    if (json.has("subject"))
16463      res.setSubject(parseReference(getJObject(json, "subject")));
16464    if (json.has("context"))
16465      res.setContext(parseReference(getJObject(json, "context")));
16466    Type occurrence = parseType("occurrence", json);
16467    if (occurrence != null)
16468      res.setOccurrence(occurrence);
16469    if (json.has("condition"))
16470      res.setCondition(parseReference(getJObject(json, "condition")));
16471    if (json.has("performer"))
16472      res.setPerformer(parseReference(getJObject(json, "performer")));
16473    Type reason = parseType("reason", json);
16474    if (reason != null)
16475      res.setReason(reason);
16476    if (json.has("basis")) {
16477      JsonArray array = json.getAsJsonArray("basis");
16478      for (int i = 0; i < array.size(); i++) {
16479        res.getBasis().add(parseReference(array.get(i).getAsJsonObject()));
16480      }
16481    };
16482    if (json.has("prediction")) {
16483      JsonArray array = json.getAsJsonArray("prediction");
16484      for (int i = 0; i < array.size(); i++) {
16485        res.getPrediction().add(parseRiskAssessmentRiskAssessmentPredictionComponent(array.get(i).getAsJsonObject(), res));
16486      }
16487    };
16488    if (json.has("mitigation"))
16489      res.setMitigationElement(parseString(json.get("mitigation").getAsString()));
16490    if (json.has("_mitigation"))
16491      parseElementProperties(getJObject(json, "_mitigation"), res.getMitigationElement());
16492    if (json.has("comment"))
16493      res.setCommentElement(parseString(json.get("comment").getAsString()));
16494    if (json.has("_comment"))
16495      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
16496  }
16497
16498  protected RiskAssessment.RiskAssessmentPredictionComponent parseRiskAssessmentRiskAssessmentPredictionComponent(JsonObject json, RiskAssessment owner) throws IOException, FHIRFormatError {
16499    RiskAssessment.RiskAssessmentPredictionComponent res = new RiskAssessment.RiskAssessmentPredictionComponent();
16500    parseRiskAssessmentRiskAssessmentPredictionComponentProperties(json, owner, res);
16501    return res;
16502  }
16503
16504  protected void parseRiskAssessmentRiskAssessmentPredictionComponentProperties(JsonObject json, RiskAssessment owner, RiskAssessment.RiskAssessmentPredictionComponent res) throws IOException, FHIRFormatError {
16505    parseBackboneProperties(json, res);
16506    if (json.has("outcome"))
16507      res.setOutcome(parseCodeableConcept(getJObject(json, "outcome")));
16508    Type probability = parseType("probability", json);
16509    if (probability != null)
16510      res.setProbability(probability);
16511    if (json.has("qualitativeRisk"))
16512      res.setQualitativeRisk(parseCodeableConcept(getJObject(json, "qualitativeRisk")));
16513    if (json.has("relativeRisk"))
16514      res.setRelativeRiskElement(parseDecimal(json.get("relativeRisk").getAsBigDecimal()));
16515    if (json.has("_relativeRisk"))
16516      parseElementProperties(getJObject(json, "_relativeRisk"), res.getRelativeRiskElement());
16517    Type when = parseType("when", json);
16518    if (when != null)
16519      res.setWhen(when);
16520    if (json.has("rationale"))
16521      res.setRationaleElement(parseString(json.get("rationale").getAsString()));
16522    if (json.has("_rationale"))
16523      parseElementProperties(getJObject(json, "_rationale"), res.getRationaleElement());
16524  }
16525
16526  protected Schedule parseSchedule(JsonObject json) throws IOException, FHIRFormatError {
16527    Schedule res = new Schedule();
16528    parseScheduleProperties(json, res);
16529    return res;
16530  }
16531
16532  protected void parseScheduleProperties(JsonObject json, Schedule res) throws IOException, FHIRFormatError {
16533    parseDomainResourceProperties(json, res);
16534    if (json.has("identifier")) {
16535      JsonArray array = json.getAsJsonArray("identifier");
16536      for (int i = 0; i < array.size(); i++) {
16537        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16538      }
16539    };
16540    if (json.has("active"))
16541      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
16542    if (json.has("_active"))
16543      parseElementProperties(getJObject(json, "_active"), res.getActiveElement());
16544    if (json.has("serviceCategory"))
16545      res.setServiceCategory(parseCodeableConcept(getJObject(json, "serviceCategory")));
16546    if (json.has("serviceType")) {
16547      JsonArray array = json.getAsJsonArray("serviceType");
16548      for (int i = 0; i < array.size(); i++) {
16549        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16550      }
16551    };
16552    if (json.has("specialty")) {
16553      JsonArray array = json.getAsJsonArray("specialty");
16554      for (int i = 0; i < array.size(); i++) {
16555        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16556      }
16557    };
16558    if (json.has("actor")) {
16559      JsonArray array = json.getAsJsonArray("actor");
16560      for (int i = 0; i < array.size(); i++) {
16561        res.getActor().add(parseReference(array.get(i).getAsJsonObject()));
16562      }
16563    };
16564    if (json.has("planningHorizon"))
16565      res.setPlanningHorizon(parsePeriod(getJObject(json, "planningHorizon")));
16566    if (json.has("comment"))
16567      res.setCommentElement(parseString(json.get("comment").getAsString()));
16568    if (json.has("_comment"))
16569      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
16570  }
16571
16572  protected SearchParameter parseSearchParameter(JsonObject json) throws IOException, FHIRFormatError {
16573    SearchParameter res = new SearchParameter();
16574    parseSearchParameterProperties(json, res);
16575    return res;
16576  }
16577
16578  protected void parseSearchParameterProperties(JsonObject json, SearchParameter res) throws IOException, FHIRFormatError {
16579    parseDomainResourceProperties(json, res);
16580    if (json.has("url"))
16581      res.setUrlElement(parseUri(json.get("url").getAsString()));
16582    if (json.has("_url"))
16583      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
16584    if (json.has("version"))
16585      res.setVersionElement(parseString(json.get("version").getAsString()));
16586    if (json.has("_version"))
16587      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
16588    if (json.has("name"))
16589      res.setNameElement(parseString(json.get("name").getAsString()));
16590    if (json.has("_name"))
16591      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
16592    if (json.has("status"))
16593      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
16594    if (json.has("_status"))
16595      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
16596    if (json.has("experimental"))
16597      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
16598    if (json.has("_experimental"))
16599      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
16600    if (json.has("date"))
16601      res.setDateElement(parseDateTime(json.get("date").getAsString()));
16602    if (json.has("_date"))
16603      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
16604    if (json.has("publisher"))
16605      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
16606    if (json.has("_publisher"))
16607      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
16608    if (json.has("contact")) {
16609      JsonArray array = json.getAsJsonArray("contact");
16610      for (int i = 0; i < array.size(); i++) {
16611        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
16612      }
16613    };
16614    if (json.has("useContext")) {
16615      JsonArray array = json.getAsJsonArray("useContext");
16616      for (int i = 0; i < array.size(); i++) {
16617        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
16618      }
16619    };
16620    if (json.has("jurisdiction")) {
16621      JsonArray array = json.getAsJsonArray("jurisdiction");
16622      for (int i = 0; i < array.size(); i++) {
16623        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16624      }
16625    };
16626    if (json.has("purpose"))
16627      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
16628    if (json.has("_purpose"))
16629      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
16630    if (json.has("code"))
16631      res.setCodeElement(parseCode(json.get("code").getAsString()));
16632    if (json.has("_code"))
16633      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
16634    if (json.has("base")) {
16635      JsonArray array = json.getAsJsonArray("base");
16636      for (int i = 0; i < array.size(); i++) {
16637        if (array.get(i).isJsonNull()) {
16638          res.getBase().add(new CodeType());
16639        } else {
16640          res.getBase().add(parseCode(array.get(i).getAsString()));
16641        }
16642      }
16643    };
16644    if (json.has("_base")) {
16645      JsonArray array = json.getAsJsonArray("_base");
16646      for (int i = 0; i < array.size(); i++) {
16647        if (i == res.getBase().size())
16648          res.getBase().add(parseCode(null));
16649        if (array.get(i) instanceof JsonObject) 
16650          parseElementProperties(array.get(i).getAsJsonObject(), res.getBase().get(i));
16651      }
16652    };
16653    if (json.has("type"))
16654      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
16655    if (json.has("_type"))
16656      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
16657    if (json.has("derivedFrom"))
16658      res.setDerivedFromElement(parseUri(json.get("derivedFrom").getAsString()));
16659    if (json.has("_derivedFrom"))
16660      parseElementProperties(getJObject(json, "_derivedFrom"), res.getDerivedFromElement());
16661    if (json.has("description"))
16662      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
16663    if (json.has("_description"))
16664      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
16665    if (json.has("expression"))
16666      res.setExpressionElement(parseString(json.get("expression").getAsString()));
16667    if (json.has("_expression"))
16668      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
16669    if (json.has("xpath"))
16670      res.setXpathElement(parseString(json.get("xpath").getAsString()));
16671    if (json.has("_xpath"))
16672      parseElementProperties(getJObject(json, "_xpath"), res.getXpathElement());
16673    if (json.has("xpathUsage"))
16674      res.setXpathUsageElement(parseEnumeration(json.get("xpathUsage").getAsString(), SearchParameter.XPathUsageType.NULL, new SearchParameter.XPathUsageTypeEnumFactory()));
16675    if (json.has("_xpathUsage"))
16676      parseElementProperties(getJObject(json, "_xpathUsage"), res.getXpathUsageElement());
16677    if (json.has("target")) {
16678      JsonArray array = json.getAsJsonArray("target");
16679      for (int i = 0; i < array.size(); i++) {
16680        if (array.get(i).isJsonNull()) {
16681          res.getTarget().add(new CodeType());
16682        } else {
16683          res.getTarget().add(parseCode(array.get(i).getAsString()));
16684        }
16685      }
16686    };
16687    if (json.has("_target")) {
16688      JsonArray array = json.getAsJsonArray("_target");
16689      for (int i = 0; i < array.size(); i++) {
16690        if (i == res.getTarget().size())
16691          res.getTarget().add(parseCode(null));
16692        if (array.get(i) instanceof JsonObject) 
16693          parseElementProperties(array.get(i).getAsJsonObject(), res.getTarget().get(i));
16694      }
16695    };
16696    if (json.has("comparator")) {
16697      JsonArray array = json.getAsJsonArray("comparator");
16698      for (int i = 0; i < array.size(); i++) {
16699        if (array.get(i).isJsonNull()) {
16700          res.getComparator().add(new Enumeration<SearchParameter.SearchComparator>());
16701        } else {
16702          res.getComparator().add(parseEnumeration(array.get(i).getAsString(), SearchParameter.SearchComparator.NULL, new SearchParameter.SearchComparatorEnumFactory()));
16703        }
16704      }
16705    };
16706    if (json.has("_comparator")) {
16707      JsonArray array = json.getAsJsonArray("_comparator");
16708      for (int i = 0; i < array.size(); i++) {
16709        if (i == res.getComparator().size())
16710          res.getComparator().add(parseEnumeration(null, SearchParameter.SearchComparator.NULL, new SearchParameter.SearchComparatorEnumFactory()));
16711        if (array.get(i) instanceof JsonObject) 
16712          parseElementProperties(array.get(i).getAsJsonObject(), res.getComparator().get(i));
16713      }
16714    };
16715    if (json.has("modifier")) {
16716      JsonArray array = json.getAsJsonArray("modifier");
16717      for (int i = 0; i < array.size(); i++) {
16718        if (array.get(i).isJsonNull()) {
16719          res.getModifier().add(new Enumeration<SearchParameter.SearchModifierCode>());
16720        } else {
16721          res.getModifier().add(parseEnumeration(array.get(i).getAsString(), SearchParameter.SearchModifierCode.NULL, new SearchParameter.SearchModifierCodeEnumFactory()));
16722        }
16723      }
16724    };
16725    if (json.has("_modifier")) {
16726      JsonArray array = json.getAsJsonArray("_modifier");
16727      for (int i = 0; i < array.size(); i++) {
16728        if (i == res.getModifier().size())
16729          res.getModifier().add(parseEnumeration(null, SearchParameter.SearchModifierCode.NULL, new SearchParameter.SearchModifierCodeEnumFactory()));
16730        if (array.get(i) instanceof JsonObject) 
16731          parseElementProperties(array.get(i).getAsJsonObject(), res.getModifier().get(i));
16732      }
16733    };
16734    if (json.has("chain")) {
16735      JsonArray array = json.getAsJsonArray("chain");
16736      for (int i = 0; i < array.size(); i++) {
16737        if (array.get(i).isJsonNull()) {
16738          res.getChain().add(new StringType());
16739        } else {
16740          res.getChain().add(parseString(array.get(i).getAsString()));
16741        }
16742      }
16743    };
16744    if (json.has("_chain")) {
16745      JsonArray array = json.getAsJsonArray("_chain");
16746      for (int i = 0; i < array.size(); i++) {
16747        if (i == res.getChain().size())
16748          res.getChain().add(parseString(null));
16749        if (array.get(i) instanceof JsonObject) 
16750          parseElementProperties(array.get(i).getAsJsonObject(), res.getChain().get(i));
16751      }
16752    };
16753    if (json.has("component")) {
16754      JsonArray array = json.getAsJsonArray("component");
16755      for (int i = 0; i < array.size(); i++) {
16756        res.getComponent().add(parseSearchParameterSearchParameterComponentComponent(array.get(i).getAsJsonObject(), res));
16757      }
16758    };
16759  }
16760
16761  protected SearchParameter.SearchParameterComponentComponent parseSearchParameterSearchParameterComponentComponent(JsonObject json, SearchParameter owner) throws IOException, FHIRFormatError {
16762    SearchParameter.SearchParameterComponentComponent res = new SearchParameter.SearchParameterComponentComponent();
16763    parseSearchParameterSearchParameterComponentComponentProperties(json, owner, res);
16764    return res;
16765  }
16766
16767  protected void parseSearchParameterSearchParameterComponentComponentProperties(JsonObject json, SearchParameter owner, SearchParameter.SearchParameterComponentComponent res) throws IOException, FHIRFormatError {
16768    parseBackboneProperties(json, res);
16769    if (json.has("definition"))
16770      res.setDefinition(parseReference(getJObject(json, "definition")));
16771    if (json.has("expression"))
16772      res.setExpressionElement(parseString(json.get("expression").getAsString()));
16773    if (json.has("_expression"))
16774      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
16775  }
16776
16777  protected Sequence parseSequence(JsonObject json) throws IOException, FHIRFormatError {
16778    Sequence res = new Sequence();
16779    parseSequenceProperties(json, res);
16780    return res;
16781  }
16782
16783  protected void parseSequenceProperties(JsonObject json, Sequence res) throws IOException, FHIRFormatError {
16784    parseDomainResourceProperties(json, res);
16785    if (json.has("identifier")) {
16786      JsonArray array = json.getAsJsonArray("identifier");
16787      for (int i = 0; i < array.size(); i++) {
16788        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16789      }
16790    };
16791    if (json.has("type"))
16792      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Sequence.SequenceType.NULL, new Sequence.SequenceTypeEnumFactory()));
16793    if (json.has("_type"))
16794      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
16795    if (json.has("coordinateSystem"))
16796      res.setCoordinateSystemElement(parseInteger(json.get("coordinateSystem").getAsLong()));
16797    if (json.has("_coordinateSystem"))
16798      parseElementProperties(getJObject(json, "_coordinateSystem"), res.getCoordinateSystemElement());
16799    if (json.has("patient"))
16800      res.setPatient(parseReference(getJObject(json, "patient")));
16801    if (json.has("specimen"))
16802      res.setSpecimen(parseReference(getJObject(json, "specimen")));
16803    if (json.has("device"))
16804      res.setDevice(parseReference(getJObject(json, "device")));
16805    if (json.has("performer"))
16806      res.setPerformer(parseReference(getJObject(json, "performer")));
16807    if (json.has("quantity"))
16808      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
16809    if (json.has("referenceSeq"))
16810      res.setReferenceSeq(parseSequenceSequenceReferenceSeqComponent(getJObject(json, "referenceSeq"), res));
16811    if (json.has("variant")) {
16812      JsonArray array = json.getAsJsonArray("variant");
16813      for (int i = 0; i < array.size(); i++) {
16814        res.getVariant().add(parseSequenceSequenceVariantComponent(array.get(i).getAsJsonObject(), res));
16815      }
16816    };
16817    if (json.has("observedSeq"))
16818      res.setObservedSeqElement(parseString(json.get("observedSeq").getAsString()));
16819    if (json.has("_observedSeq"))
16820      parseElementProperties(getJObject(json, "_observedSeq"), res.getObservedSeqElement());
16821    if (json.has("quality")) {
16822      JsonArray array = json.getAsJsonArray("quality");
16823      for (int i = 0; i < array.size(); i++) {
16824        res.getQuality().add(parseSequenceSequenceQualityComponent(array.get(i).getAsJsonObject(), res));
16825      }
16826    };
16827    if (json.has("readCoverage"))
16828      res.setReadCoverageElement(parseInteger(json.get("readCoverage").getAsLong()));
16829    if (json.has("_readCoverage"))
16830      parseElementProperties(getJObject(json, "_readCoverage"), res.getReadCoverageElement());
16831    if (json.has("repository")) {
16832      JsonArray array = json.getAsJsonArray("repository");
16833      for (int i = 0; i < array.size(); i++) {
16834        res.getRepository().add(parseSequenceSequenceRepositoryComponent(array.get(i).getAsJsonObject(), res));
16835      }
16836    };
16837    if (json.has("pointer")) {
16838      JsonArray array = json.getAsJsonArray("pointer");
16839      for (int i = 0; i < array.size(); i++) {
16840        res.getPointer().add(parseReference(array.get(i).getAsJsonObject()));
16841      }
16842    };
16843  }
16844
16845  protected Sequence.SequenceReferenceSeqComponent parseSequenceSequenceReferenceSeqComponent(JsonObject json, Sequence owner) throws IOException, FHIRFormatError {
16846    Sequence.SequenceReferenceSeqComponent res = new Sequence.SequenceReferenceSeqComponent();
16847    parseSequenceSequenceReferenceSeqComponentProperties(json, owner, res);
16848    return res;
16849  }
16850
16851  protected void parseSequenceSequenceReferenceSeqComponentProperties(JsonObject json, Sequence owner, Sequence.SequenceReferenceSeqComponent res) throws IOException, FHIRFormatError {
16852    parseBackboneProperties(json, res);
16853    if (json.has("chromosome"))
16854      res.setChromosome(parseCodeableConcept(getJObject(json, "chromosome")));
16855    if (json.has("genomeBuild"))
16856      res.setGenomeBuildElement(parseString(json.get("genomeBuild").getAsString()));
16857    if (json.has("_genomeBuild"))
16858      parseElementProperties(getJObject(json, "_genomeBuild"), res.getGenomeBuildElement());
16859    if (json.has("referenceSeqId"))
16860      res.setReferenceSeqId(parseCodeableConcept(getJObject(json, "referenceSeqId")));
16861    if (json.has("referenceSeqPointer"))
16862      res.setReferenceSeqPointer(parseReference(getJObject(json, "referenceSeqPointer")));
16863    if (json.has("referenceSeqString"))
16864      res.setReferenceSeqStringElement(parseString(json.get("referenceSeqString").getAsString()));
16865    if (json.has("_referenceSeqString"))
16866      parseElementProperties(getJObject(json, "_referenceSeqString"), res.getReferenceSeqStringElement());
16867    if (json.has("strand"))
16868      res.setStrandElement(parseInteger(json.get("strand").getAsLong()));
16869    if (json.has("_strand"))
16870      parseElementProperties(getJObject(json, "_strand"), res.getStrandElement());
16871    if (json.has("windowStart"))
16872      res.setWindowStartElement(parseInteger(json.get("windowStart").getAsLong()));
16873    if (json.has("_windowStart"))
16874      parseElementProperties(getJObject(json, "_windowStart"), res.getWindowStartElement());
16875    if (json.has("windowEnd"))
16876      res.setWindowEndElement(parseInteger(json.get("windowEnd").getAsLong()));
16877    if (json.has("_windowEnd"))
16878      parseElementProperties(getJObject(json, "_windowEnd"), res.getWindowEndElement());
16879  }
16880
16881  protected Sequence.SequenceVariantComponent parseSequenceSequenceVariantComponent(JsonObject json, Sequence owner) throws IOException, FHIRFormatError {
16882    Sequence.SequenceVariantComponent res = new Sequence.SequenceVariantComponent();
16883    parseSequenceSequenceVariantComponentProperties(json, owner, res);
16884    return res;
16885  }
16886
16887  protected void parseSequenceSequenceVariantComponentProperties(JsonObject json, Sequence owner, Sequence.SequenceVariantComponent res) throws IOException, FHIRFormatError {
16888    parseBackboneProperties(json, res);
16889    if (json.has("start"))
16890      res.setStartElement(parseInteger(json.get("start").getAsLong()));
16891    if (json.has("_start"))
16892      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
16893    if (json.has("end"))
16894      res.setEndElement(parseInteger(json.get("end").getAsLong()));
16895    if (json.has("_end"))
16896      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
16897    if (json.has("observedAllele"))
16898      res.setObservedAlleleElement(parseString(json.get("observedAllele").getAsString()));
16899    if (json.has("_observedAllele"))
16900      parseElementProperties(getJObject(json, "_observedAllele"), res.getObservedAlleleElement());
16901    if (json.has("referenceAllele"))
16902      res.setReferenceAlleleElement(parseString(json.get("referenceAllele").getAsString()));
16903    if (json.has("_referenceAllele"))
16904      parseElementProperties(getJObject(json, "_referenceAllele"), res.getReferenceAlleleElement());
16905    if (json.has("cigar"))
16906      res.setCigarElement(parseString(json.get("cigar").getAsString()));
16907    if (json.has("_cigar"))
16908      parseElementProperties(getJObject(json, "_cigar"), res.getCigarElement());
16909    if (json.has("variantPointer"))
16910      res.setVariantPointer(parseReference(getJObject(json, "variantPointer")));
16911  }
16912
16913  protected Sequence.SequenceQualityComponent parseSequenceSequenceQualityComponent(JsonObject json, Sequence owner) throws IOException, FHIRFormatError {
16914    Sequence.SequenceQualityComponent res = new Sequence.SequenceQualityComponent();
16915    parseSequenceSequenceQualityComponentProperties(json, owner, res);
16916    return res;
16917  }
16918
16919  protected void parseSequenceSequenceQualityComponentProperties(JsonObject json, Sequence owner, Sequence.SequenceQualityComponent res) throws IOException, FHIRFormatError {
16920    parseBackboneProperties(json, res);
16921    if (json.has("type"))
16922      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Sequence.QualityType.NULL, new Sequence.QualityTypeEnumFactory()));
16923    if (json.has("_type"))
16924      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
16925    if (json.has("standardSequence"))
16926      res.setStandardSequence(parseCodeableConcept(getJObject(json, "standardSequence")));
16927    if (json.has("start"))
16928      res.setStartElement(parseInteger(json.get("start").getAsLong()));
16929    if (json.has("_start"))
16930      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
16931    if (json.has("end"))
16932      res.setEndElement(parseInteger(json.get("end").getAsLong()));
16933    if (json.has("_end"))
16934      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
16935    if (json.has("score"))
16936      res.setScore(parseQuantity(getJObject(json, "score")));
16937    if (json.has("method"))
16938      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
16939    if (json.has("truthTP"))
16940      res.setTruthTPElement(parseDecimal(json.get("truthTP").getAsBigDecimal()));
16941    if (json.has("_truthTP"))
16942      parseElementProperties(getJObject(json, "_truthTP"), res.getTruthTPElement());
16943    if (json.has("queryTP"))
16944      res.setQueryTPElement(parseDecimal(json.get("queryTP").getAsBigDecimal()));
16945    if (json.has("_queryTP"))
16946      parseElementProperties(getJObject(json, "_queryTP"), res.getQueryTPElement());
16947    if (json.has("truthFN"))
16948      res.setTruthFNElement(parseDecimal(json.get("truthFN").getAsBigDecimal()));
16949    if (json.has("_truthFN"))
16950      parseElementProperties(getJObject(json, "_truthFN"), res.getTruthFNElement());
16951    if (json.has("queryFP"))
16952      res.setQueryFPElement(parseDecimal(json.get("queryFP").getAsBigDecimal()));
16953    if (json.has("_queryFP"))
16954      parseElementProperties(getJObject(json, "_queryFP"), res.getQueryFPElement());
16955    if (json.has("gtFP"))
16956      res.setGtFPElement(parseDecimal(json.get("gtFP").getAsBigDecimal()));
16957    if (json.has("_gtFP"))
16958      parseElementProperties(getJObject(json, "_gtFP"), res.getGtFPElement());
16959    if (json.has("precision"))
16960      res.setPrecisionElement(parseDecimal(json.get("precision").getAsBigDecimal()));
16961    if (json.has("_precision"))
16962      parseElementProperties(getJObject(json, "_precision"), res.getPrecisionElement());
16963    if (json.has("recall"))
16964      res.setRecallElement(parseDecimal(json.get("recall").getAsBigDecimal()));
16965    if (json.has("_recall"))
16966      parseElementProperties(getJObject(json, "_recall"), res.getRecallElement());
16967    if (json.has("fScore"))
16968      res.setFScoreElement(parseDecimal(json.get("fScore").getAsBigDecimal()));
16969    if (json.has("_fScore"))
16970      parseElementProperties(getJObject(json, "_fScore"), res.getFScoreElement());
16971  }
16972
16973  protected Sequence.SequenceRepositoryComponent parseSequenceSequenceRepositoryComponent(JsonObject json, Sequence owner) throws IOException, FHIRFormatError {
16974    Sequence.SequenceRepositoryComponent res = new Sequence.SequenceRepositoryComponent();
16975    parseSequenceSequenceRepositoryComponentProperties(json, owner, res);
16976    return res;
16977  }
16978
16979  protected void parseSequenceSequenceRepositoryComponentProperties(JsonObject json, Sequence owner, Sequence.SequenceRepositoryComponent res) throws IOException, FHIRFormatError {
16980    parseBackboneProperties(json, res);
16981    if (json.has("type"))
16982      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Sequence.RepositoryType.NULL, new Sequence.RepositoryTypeEnumFactory()));
16983    if (json.has("_type"))
16984      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
16985    if (json.has("url"))
16986      res.setUrlElement(parseUri(json.get("url").getAsString()));
16987    if (json.has("_url"))
16988      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
16989    if (json.has("name"))
16990      res.setNameElement(parseString(json.get("name").getAsString()));
16991    if (json.has("_name"))
16992      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
16993    if (json.has("datasetId"))
16994      res.setDatasetIdElement(parseString(json.get("datasetId").getAsString()));
16995    if (json.has("_datasetId"))
16996      parseElementProperties(getJObject(json, "_datasetId"), res.getDatasetIdElement());
16997    if (json.has("variantsetId"))
16998      res.setVariantsetIdElement(parseString(json.get("variantsetId").getAsString()));
16999    if (json.has("_variantsetId"))
17000      parseElementProperties(getJObject(json, "_variantsetId"), res.getVariantsetIdElement());
17001    if (json.has("readsetId"))
17002      res.setReadsetIdElement(parseString(json.get("readsetId").getAsString()));
17003    if (json.has("_readsetId"))
17004      parseElementProperties(getJObject(json, "_readsetId"), res.getReadsetIdElement());
17005  }
17006
17007  protected ServiceDefinition parseServiceDefinition(JsonObject json) throws IOException, FHIRFormatError {
17008    ServiceDefinition res = new ServiceDefinition();
17009    parseServiceDefinitionProperties(json, res);
17010    return res;
17011  }
17012
17013  protected void parseServiceDefinitionProperties(JsonObject json, ServiceDefinition res) throws IOException, FHIRFormatError {
17014    parseDomainResourceProperties(json, res);
17015    if (json.has("url"))
17016      res.setUrlElement(parseUri(json.get("url").getAsString()));
17017    if (json.has("_url"))
17018      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
17019    if (json.has("identifier")) {
17020      JsonArray array = json.getAsJsonArray("identifier");
17021      for (int i = 0; i < array.size(); i++) {
17022        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17023      }
17024    };
17025    if (json.has("version"))
17026      res.setVersionElement(parseString(json.get("version").getAsString()));
17027    if (json.has("_version"))
17028      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
17029    if (json.has("name"))
17030      res.setNameElement(parseString(json.get("name").getAsString()));
17031    if (json.has("_name"))
17032      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
17033    if (json.has("title"))
17034      res.setTitleElement(parseString(json.get("title").getAsString()));
17035    if (json.has("_title"))
17036      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
17037    if (json.has("status"))
17038      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
17039    if (json.has("_status"))
17040      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
17041    if (json.has("experimental"))
17042      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
17043    if (json.has("_experimental"))
17044      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
17045    if (json.has("date"))
17046      res.setDateElement(parseDateTime(json.get("date").getAsString()));
17047    if (json.has("_date"))
17048      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
17049    if (json.has("publisher"))
17050      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
17051    if (json.has("_publisher"))
17052      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
17053    if (json.has("description"))
17054      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
17055    if (json.has("_description"))
17056      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
17057    if (json.has("purpose"))
17058      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
17059    if (json.has("_purpose"))
17060      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
17061    if (json.has("usage"))
17062      res.setUsageElement(parseString(json.get("usage").getAsString()));
17063    if (json.has("_usage"))
17064      parseElementProperties(getJObject(json, "_usage"), res.getUsageElement());
17065    if (json.has("approvalDate"))
17066      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
17067    if (json.has("_approvalDate"))
17068      parseElementProperties(getJObject(json, "_approvalDate"), res.getApprovalDateElement());
17069    if (json.has("lastReviewDate"))
17070      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
17071    if (json.has("_lastReviewDate"))
17072      parseElementProperties(getJObject(json, "_lastReviewDate"), res.getLastReviewDateElement());
17073    if (json.has("effectivePeriod"))
17074      res.setEffectivePeriod(parsePeriod(getJObject(json, "effectivePeriod")));
17075    if (json.has("useContext")) {
17076      JsonArray array = json.getAsJsonArray("useContext");
17077      for (int i = 0; i < array.size(); i++) {
17078        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
17079      }
17080    };
17081    if (json.has("jurisdiction")) {
17082      JsonArray array = json.getAsJsonArray("jurisdiction");
17083      for (int i = 0; i < array.size(); i++) {
17084        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17085      }
17086    };
17087    if (json.has("topic")) {
17088      JsonArray array = json.getAsJsonArray("topic");
17089      for (int i = 0; i < array.size(); i++) {
17090        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17091      }
17092    };
17093    if (json.has("contributor")) {
17094      JsonArray array = json.getAsJsonArray("contributor");
17095      for (int i = 0; i < array.size(); i++) {
17096        res.getContributor().add(parseContributor(array.get(i).getAsJsonObject()));
17097      }
17098    };
17099    if (json.has("contact")) {
17100      JsonArray array = json.getAsJsonArray("contact");
17101      for (int i = 0; i < array.size(); i++) {
17102        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
17103      }
17104    };
17105    if (json.has("copyright"))
17106      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
17107    if (json.has("_copyright"))
17108      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
17109    if (json.has("relatedArtifact")) {
17110      JsonArray array = json.getAsJsonArray("relatedArtifact");
17111      for (int i = 0; i < array.size(); i++) {
17112        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
17113      }
17114    };
17115    if (json.has("trigger")) {
17116      JsonArray array = json.getAsJsonArray("trigger");
17117      for (int i = 0; i < array.size(); i++) {
17118        res.getTrigger().add(parseTriggerDefinition(array.get(i).getAsJsonObject()));
17119      }
17120    };
17121    if (json.has("dataRequirement")) {
17122      JsonArray array = json.getAsJsonArray("dataRequirement");
17123      for (int i = 0; i < array.size(); i++) {
17124        res.getDataRequirement().add(parseDataRequirement(array.get(i).getAsJsonObject()));
17125      }
17126    };
17127    if (json.has("operationDefinition"))
17128      res.setOperationDefinition(parseReference(getJObject(json, "operationDefinition")));
17129  }
17130
17131  protected Slot parseSlot(JsonObject json) throws IOException, FHIRFormatError {
17132    Slot res = new Slot();
17133    parseSlotProperties(json, res);
17134    return res;
17135  }
17136
17137  protected void parseSlotProperties(JsonObject json, Slot res) throws IOException, FHIRFormatError {
17138    parseDomainResourceProperties(json, res);
17139    if (json.has("identifier")) {
17140      JsonArray array = json.getAsJsonArray("identifier");
17141      for (int i = 0; i < array.size(); i++) {
17142        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17143      }
17144    };
17145    if (json.has("serviceCategory"))
17146      res.setServiceCategory(parseCodeableConcept(getJObject(json, "serviceCategory")));
17147    if (json.has("serviceType")) {
17148      JsonArray array = json.getAsJsonArray("serviceType");
17149      for (int i = 0; i < array.size(); i++) {
17150        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17151      }
17152    };
17153    if (json.has("specialty")) {
17154      JsonArray array = json.getAsJsonArray("specialty");
17155      for (int i = 0; i < array.size(); i++) {
17156        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17157      }
17158    };
17159    if (json.has("appointmentType"))
17160      res.setAppointmentType(parseCodeableConcept(getJObject(json, "appointmentType")));
17161    if (json.has("schedule"))
17162      res.setSchedule(parseReference(getJObject(json, "schedule")));
17163    if (json.has("status"))
17164      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Slot.SlotStatus.NULL, new Slot.SlotStatusEnumFactory()));
17165    if (json.has("_status"))
17166      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
17167    if (json.has("start"))
17168      res.setStartElement(parseInstant(json.get("start").getAsString()));
17169    if (json.has("_start"))
17170      parseElementProperties(getJObject(json, "_start"), res.getStartElement());
17171    if (json.has("end"))
17172      res.setEndElement(parseInstant(json.get("end").getAsString()));
17173    if (json.has("_end"))
17174      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
17175    if (json.has("overbooked"))
17176      res.setOverbookedElement(parseBoolean(json.get("overbooked").getAsBoolean()));
17177    if (json.has("_overbooked"))
17178      parseElementProperties(getJObject(json, "_overbooked"), res.getOverbookedElement());
17179    if (json.has("comment"))
17180      res.setCommentElement(parseString(json.get("comment").getAsString()));
17181    if (json.has("_comment"))
17182      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
17183  }
17184
17185  protected Specimen parseSpecimen(JsonObject json) throws IOException, FHIRFormatError {
17186    Specimen res = new Specimen();
17187    parseSpecimenProperties(json, res);
17188    return res;
17189  }
17190
17191  protected void parseSpecimenProperties(JsonObject json, Specimen res) throws IOException, FHIRFormatError {
17192    parseDomainResourceProperties(json, res);
17193    if (json.has("identifier")) {
17194      JsonArray array = json.getAsJsonArray("identifier");
17195      for (int i = 0; i < array.size(); i++) {
17196        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17197      }
17198    };
17199    if (json.has("accessionIdentifier"))
17200      res.setAccessionIdentifier(parseIdentifier(getJObject(json, "accessionIdentifier")));
17201    if (json.has("status"))
17202      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Specimen.SpecimenStatus.NULL, new Specimen.SpecimenStatusEnumFactory()));
17203    if (json.has("_status"))
17204      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
17205    if (json.has("type"))
17206      res.setType(parseCodeableConcept(getJObject(json, "type")));
17207    if (json.has("subject"))
17208      res.setSubject(parseReference(getJObject(json, "subject")));
17209    if (json.has("receivedTime"))
17210      res.setReceivedTimeElement(parseDateTime(json.get("receivedTime").getAsString()));
17211    if (json.has("_receivedTime"))
17212      parseElementProperties(getJObject(json, "_receivedTime"), res.getReceivedTimeElement());
17213    if (json.has("parent")) {
17214      JsonArray array = json.getAsJsonArray("parent");
17215      for (int i = 0; i < array.size(); i++) {
17216        res.getParent().add(parseReference(array.get(i).getAsJsonObject()));
17217      }
17218    };
17219    if (json.has("request")) {
17220      JsonArray array = json.getAsJsonArray("request");
17221      for (int i = 0; i < array.size(); i++) {
17222        res.getRequest().add(parseReference(array.get(i).getAsJsonObject()));
17223      }
17224    };
17225    if (json.has("collection"))
17226      res.setCollection(parseSpecimenSpecimenCollectionComponent(getJObject(json, "collection"), res));
17227    if (json.has("processing")) {
17228      JsonArray array = json.getAsJsonArray("processing");
17229      for (int i = 0; i < array.size(); i++) {
17230        res.getProcessing().add(parseSpecimenSpecimenProcessingComponent(array.get(i).getAsJsonObject(), res));
17231      }
17232    };
17233    if (json.has("container")) {
17234      JsonArray array = json.getAsJsonArray("container");
17235      for (int i = 0; i < array.size(); i++) {
17236        res.getContainer().add(parseSpecimenSpecimenContainerComponent(array.get(i).getAsJsonObject(), res));
17237      }
17238    };
17239    if (json.has("note")) {
17240      JsonArray array = json.getAsJsonArray("note");
17241      for (int i = 0; i < array.size(); i++) {
17242        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
17243      }
17244    };
17245  }
17246
17247  protected Specimen.SpecimenCollectionComponent parseSpecimenSpecimenCollectionComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
17248    Specimen.SpecimenCollectionComponent res = new Specimen.SpecimenCollectionComponent();
17249    parseSpecimenSpecimenCollectionComponentProperties(json, owner, res);
17250    return res;
17251  }
17252
17253  protected void parseSpecimenSpecimenCollectionComponentProperties(JsonObject json, Specimen owner, Specimen.SpecimenCollectionComponent res) throws IOException, FHIRFormatError {
17254    parseBackboneProperties(json, res);
17255    if (json.has("collector"))
17256      res.setCollector(parseReference(getJObject(json, "collector")));
17257    Type collected = parseType("collected", json);
17258    if (collected != null)
17259      res.setCollected(collected);
17260    if (json.has("quantity"))
17261      res.setQuantity(parseSimpleQuantity(getJObject(json, "quantity")));
17262    if (json.has("method"))
17263      res.setMethod(parseCodeableConcept(getJObject(json, "method")));
17264    if (json.has("bodySite"))
17265      res.setBodySite(parseCodeableConcept(getJObject(json, "bodySite")));
17266  }
17267
17268  protected Specimen.SpecimenProcessingComponent parseSpecimenSpecimenProcessingComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
17269    Specimen.SpecimenProcessingComponent res = new Specimen.SpecimenProcessingComponent();
17270    parseSpecimenSpecimenProcessingComponentProperties(json, owner, res);
17271    return res;
17272  }
17273
17274  protected void parseSpecimenSpecimenProcessingComponentProperties(JsonObject json, Specimen owner, Specimen.SpecimenProcessingComponent res) throws IOException, FHIRFormatError {
17275    parseBackboneProperties(json, res);
17276    if (json.has("description"))
17277      res.setDescriptionElement(parseString(json.get("description").getAsString()));
17278    if (json.has("_description"))
17279      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
17280    if (json.has("procedure"))
17281      res.setProcedure(parseCodeableConcept(getJObject(json, "procedure")));
17282    if (json.has("additive")) {
17283      JsonArray array = json.getAsJsonArray("additive");
17284      for (int i = 0; i < array.size(); i++) {
17285        res.getAdditive().add(parseReference(array.get(i).getAsJsonObject()));
17286      }
17287    };
17288    Type time = parseType("time", json);
17289    if (time != null)
17290      res.setTime(time);
17291  }
17292
17293  protected Specimen.SpecimenContainerComponent parseSpecimenSpecimenContainerComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
17294    Specimen.SpecimenContainerComponent res = new Specimen.SpecimenContainerComponent();
17295    parseSpecimenSpecimenContainerComponentProperties(json, owner, res);
17296    return res;
17297  }
17298
17299  protected void parseSpecimenSpecimenContainerComponentProperties(JsonObject json, Specimen owner, Specimen.SpecimenContainerComponent res) throws IOException, FHIRFormatError {
17300    parseBackboneProperties(json, res);
17301    if (json.has("identifier")) {
17302      JsonArray array = json.getAsJsonArray("identifier");
17303      for (int i = 0; i < array.size(); i++) {
17304        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17305      }
17306    };
17307    if (json.has("description"))
17308      res.setDescriptionElement(parseString(json.get("description").getAsString()));
17309    if (json.has("_description"))
17310      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
17311    if (json.has("type"))
17312      res.setType(parseCodeableConcept(getJObject(json, "type")));
17313    if (json.has("capacity"))
17314      res.setCapacity(parseSimpleQuantity(getJObject(json, "capacity")));
17315    if (json.has("specimenQuantity"))
17316      res.setSpecimenQuantity(parseSimpleQuantity(getJObject(json, "specimenQuantity")));
17317    Type additive = parseType("additive", json);
17318    if (additive != null)
17319      res.setAdditive(additive);
17320  }
17321
17322  protected StructureDefinition parseStructureDefinition(JsonObject json) throws IOException, FHIRFormatError {
17323    StructureDefinition res = new StructureDefinition();
17324    parseStructureDefinitionProperties(json, res);
17325    return res;
17326  }
17327
17328  protected void parseStructureDefinitionProperties(JsonObject json, StructureDefinition res) throws IOException, FHIRFormatError {
17329    parseDomainResourceProperties(json, res);
17330    if (json.has("url"))
17331      res.setUrlElement(parseUri(json.get("url").getAsString()));
17332    if (json.has("_url"))
17333      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
17334    if (json.has("identifier")) {
17335      JsonArray array = json.getAsJsonArray("identifier");
17336      for (int i = 0; i < array.size(); i++) {
17337        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17338      }
17339    };
17340    if (json.has("version"))
17341      res.setVersionElement(parseString(json.get("version").getAsString()));
17342    if (json.has("_version"))
17343      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
17344    if (json.has("name"))
17345      res.setNameElement(parseString(json.get("name").getAsString()));
17346    if (json.has("_name"))
17347      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
17348    if (json.has("title"))
17349      res.setTitleElement(parseString(json.get("title").getAsString()));
17350    if (json.has("_title"))
17351      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
17352    if (json.has("status"))
17353      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
17354    if (json.has("_status"))
17355      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
17356    if (json.has("experimental"))
17357      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
17358    if (json.has("_experimental"))
17359      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
17360    if (json.has("date"))
17361      res.setDateElement(parseDateTime(json.get("date").getAsString()));
17362    if (json.has("_date"))
17363      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
17364    if (json.has("publisher"))
17365      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
17366    if (json.has("_publisher"))
17367      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
17368    if (json.has("contact")) {
17369      JsonArray array = json.getAsJsonArray("contact");
17370      for (int i = 0; i < array.size(); i++) {
17371        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
17372      }
17373    };
17374    if (json.has("description"))
17375      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
17376    if (json.has("_description"))
17377      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
17378    if (json.has("useContext")) {
17379      JsonArray array = json.getAsJsonArray("useContext");
17380      for (int i = 0; i < array.size(); i++) {
17381        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
17382      }
17383    };
17384    if (json.has("jurisdiction")) {
17385      JsonArray array = json.getAsJsonArray("jurisdiction");
17386      for (int i = 0; i < array.size(); i++) {
17387        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17388      }
17389    };
17390    if (json.has("purpose"))
17391      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
17392    if (json.has("_purpose"))
17393      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
17394    if (json.has("copyright"))
17395      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
17396    if (json.has("_copyright"))
17397      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
17398    if (json.has("keyword")) {
17399      JsonArray array = json.getAsJsonArray("keyword");
17400      for (int i = 0; i < array.size(); i++) {
17401        res.getKeyword().add(parseCoding(array.get(i).getAsJsonObject()));
17402      }
17403    };
17404    if (json.has("fhirVersion"))
17405      res.setFhirVersionElement(parseId(json.get("fhirVersion").getAsString()));
17406    if (json.has("_fhirVersion"))
17407      parseElementProperties(getJObject(json, "_fhirVersion"), res.getFhirVersionElement());
17408    if (json.has("mapping")) {
17409      JsonArray array = json.getAsJsonArray("mapping");
17410      for (int i = 0; i < array.size(); i++) {
17411        res.getMapping().add(parseStructureDefinitionStructureDefinitionMappingComponent(array.get(i).getAsJsonObject(), res));
17412      }
17413    };
17414    if (json.has("kind"))
17415      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), StructureDefinition.StructureDefinitionKind.NULL, new StructureDefinition.StructureDefinitionKindEnumFactory()));
17416    if (json.has("_kind"))
17417      parseElementProperties(getJObject(json, "_kind"), res.getKindElement());
17418    if (json.has("abstract"))
17419      res.setAbstractElement(parseBoolean(json.get("abstract").getAsBoolean()));
17420    if (json.has("_abstract"))
17421      parseElementProperties(getJObject(json, "_abstract"), res.getAbstractElement());
17422    if (json.has("contextType"))
17423      res.setContextTypeElement(parseEnumeration(json.get("contextType").getAsString(), StructureDefinition.ExtensionContext.NULL, new StructureDefinition.ExtensionContextEnumFactory()));
17424    if (json.has("_contextType"))
17425      parseElementProperties(getJObject(json, "_contextType"), res.getContextTypeElement());
17426    if (json.has("context")) {
17427      JsonArray array = json.getAsJsonArray("context");
17428      for (int i = 0; i < array.size(); i++) {
17429        if (array.get(i).isJsonNull()) {
17430          res.getContext().add(new StringType());
17431        } else {
17432          res.getContext().add(parseString(array.get(i).getAsString()));
17433        }
17434      }
17435    };
17436    if (json.has("_context")) {
17437      JsonArray array = json.getAsJsonArray("_context");
17438      for (int i = 0; i < array.size(); i++) {
17439        if (i == res.getContext().size())
17440          res.getContext().add(parseString(null));
17441        if (array.get(i) instanceof JsonObject) 
17442          parseElementProperties(array.get(i).getAsJsonObject(), res.getContext().get(i));
17443      }
17444    };
17445    if (json.has("contextInvariant")) {
17446      JsonArray array = json.getAsJsonArray("contextInvariant");
17447      for (int i = 0; i < array.size(); i++) {
17448        if (array.get(i).isJsonNull()) {
17449          res.getContextInvariant().add(new StringType());
17450        } else {
17451          res.getContextInvariant().add(parseString(array.get(i).getAsString()));
17452        }
17453      }
17454    };
17455    if (json.has("_contextInvariant")) {
17456      JsonArray array = json.getAsJsonArray("_contextInvariant");
17457      for (int i = 0; i < array.size(); i++) {
17458        if (i == res.getContextInvariant().size())
17459          res.getContextInvariant().add(parseString(null));
17460        if (array.get(i) instanceof JsonObject) 
17461          parseElementProperties(array.get(i).getAsJsonObject(), res.getContextInvariant().get(i));
17462      }
17463    };
17464    if (json.has("type"))
17465      res.setTypeElement(parseCode(json.get("type").getAsString()));
17466    if (json.has("_type"))
17467      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
17468    if (json.has("baseDefinition"))
17469      res.setBaseDefinitionElement(parseUri(json.get("baseDefinition").getAsString()));
17470    if (json.has("_baseDefinition"))
17471      parseElementProperties(getJObject(json, "_baseDefinition"), res.getBaseDefinitionElement());
17472    if (json.has("derivation"))
17473      res.setDerivationElement(parseEnumeration(json.get("derivation").getAsString(), StructureDefinition.TypeDerivationRule.NULL, new StructureDefinition.TypeDerivationRuleEnumFactory()));
17474    if (json.has("_derivation"))
17475      parseElementProperties(getJObject(json, "_derivation"), res.getDerivationElement());
17476    if (json.has("snapshot"))
17477      res.setSnapshot(parseStructureDefinitionStructureDefinitionSnapshotComponent(getJObject(json, "snapshot"), res));
17478    if (json.has("differential"))
17479      res.setDifferential(parseStructureDefinitionStructureDefinitionDifferentialComponent(getJObject(json, "differential"), res));
17480  }
17481
17482  protected StructureDefinition.StructureDefinitionMappingComponent parseStructureDefinitionStructureDefinitionMappingComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
17483    StructureDefinition.StructureDefinitionMappingComponent res = new StructureDefinition.StructureDefinitionMappingComponent();
17484    parseStructureDefinitionStructureDefinitionMappingComponentProperties(json, owner, res);
17485    return res;
17486  }
17487
17488  protected void parseStructureDefinitionStructureDefinitionMappingComponentProperties(JsonObject json, StructureDefinition owner, StructureDefinition.StructureDefinitionMappingComponent res) throws IOException, FHIRFormatError {
17489    parseBackboneProperties(json, res);
17490    if (json.has("identity"))
17491      res.setIdentityElement(parseId(json.get("identity").getAsString()));
17492    if (json.has("_identity"))
17493      parseElementProperties(getJObject(json, "_identity"), res.getIdentityElement());
17494    if (json.has("uri"))
17495      res.setUriElement(parseUri(json.get("uri").getAsString()));
17496    if (json.has("_uri"))
17497      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
17498    if (json.has("name"))
17499      res.setNameElement(parseString(json.get("name").getAsString()));
17500    if (json.has("_name"))
17501      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
17502    if (json.has("comment"))
17503      res.setCommentElement(parseString(json.get("comment").getAsString()));
17504    if (json.has("_comment"))
17505      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
17506  }
17507
17508  protected StructureDefinition.StructureDefinitionSnapshotComponent parseStructureDefinitionStructureDefinitionSnapshotComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
17509    StructureDefinition.StructureDefinitionSnapshotComponent res = new StructureDefinition.StructureDefinitionSnapshotComponent();
17510    parseStructureDefinitionStructureDefinitionSnapshotComponentProperties(json, owner, res);
17511    return res;
17512  }
17513
17514  protected void parseStructureDefinitionStructureDefinitionSnapshotComponentProperties(JsonObject json, StructureDefinition owner, StructureDefinition.StructureDefinitionSnapshotComponent res) throws IOException, FHIRFormatError {
17515    parseBackboneProperties(json, res);
17516    if (json.has("element")) {
17517      JsonArray array = json.getAsJsonArray("element");
17518      for (int i = 0; i < array.size(); i++) {
17519        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
17520      }
17521    };
17522  }
17523
17524  protected StructureDefinition.StructureDefinitionDifferentialComponent parseStructureDefinitionStructureDefinitionDifferentialComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
17525    StructureDefinition.StructureDefinitionDifferentialComponent res = new StructureDefinition.StructureDefinitionDifferentialComponent();
17526    parseStructureDefinitionStructureDefinitionDifferentialComponentProperties(json, owner, res);
17527    return res;
17528  }
17529
17530  protected void parseStructureDefinitionStructureDefinitionDifferentialComponentProperties(JsonObject json, StructureDefinition owner, StructureDefinition.StructureDefinitionDifferentialComponent res) throws IOException, FHIRFormatError {
17531    parseBackboneProperties(json, res);
17532    if (json.has("element")) {
17533      JsonArray array = json.getAsJsonArray("element");
17534      for (int i = 0; i < array.size(); i++) {
17535        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
17536      }
17537    };
17538  }
17539
17540  protected StructureMap parseStructureMap(JsonObject json) throws IOException, FHIRFormatError {
17541    StructureMap res = new StructureMap();
17542    parseStructureMapProperties(json, res);
17543    return res;
17544  }
17545
17546  protected void parseStructureMapProperties(JsonObject json, StructureMap res) throws IOException, FHIRFormatError {
17547    parseDomainResourceProperties(json, res);
17548    if (json.has("url"))
17549      res.setUrlElement(parseUri(json.get("url").getAsString()));
17550    if (json.has("_url"))
17551      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
17552    if (json.has("identifier")) {
17553      JsonArray array = json.getAsJsonArray("identifier");
17554      for (int i = 0; i < array.size(); i++) {
17555        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17556      }
17557    };
17558    if (json.has("version"))
17559      res.setVersionElement(parseString(json.get("version").getAsString()));
17560    if (json.has("_version"))
17561      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
17562    if (json.has("name"))
17563      res.setNameElement(parseString(json.get("name").getAsString()));
17564    if (json.has("_name"))
17565      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
17566    if (json.has("title"))
17567      res.setTitleElement(parseString(json.get("title").getAsString()));
17568    if (json.has("_title"))
17569      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
17570    if (json.has("status"))
17571      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
17572    if (json.has("_status"))
17573      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
17574    if (json.has("experimental"))
17575      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
17576    if (json.has("_experimental"))
17577      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
17578    if (json.has("date"))
17579      res.setDateElement(parseDateTime(json.get("date").getAsString()));
17580    if (json.has("_date"))
17581      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
17582    if (json.has("publisher"))
17583      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
17584    if (json.has("_publisher"))
17585      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
17586    if (json.has("contact")) {
17587      JsonArray array = json.getAsJsonArray("contact");
17588      for (int i = 0; i < array.size(); i++) {
17589        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
17590      }
17591    };
17592    if (json.has("description"))
17593      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
17594    if (json.has("_description"))
17595      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
17596    if (json.has("useContext")) {
17597      JsonArray array = json.getAsJsonArray("useContext");
17598      for (int i = 0; i < array.size(); i++) {
17599        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
17600      }
17601    };
17602    if (json.has("jurisdiction")) {
17603      JsonArray array = json.getAsJsonArray("jurisdiction");
17604      for (int i = 0; i < array.size(); i++) {
17605        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17606      }
17607    };
17608    if (json.has("purpose"))
17609      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
17610    if (json.has("_purpose"))
17611      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
17612    if (json.has("copyright"))
17613      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
17614    if (json.has("_copyright"))
17615      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
17616    if (json.has("structure")) {
17617      JsonArray array = json.getAsJsonArray("structure");
17618      for (int i = 0; i < array.size(); i++) {
17619        res.getStructure().add(parseStructureMapStructureMapStructureComponent(array.get(i).getAsJsonObject(), res));
17620      }
17621    };
17622    if (json.has("import")) {
17623      JsonArray array = json.getAsJsonArray("import");
17624      for (int i = 0; i < array.size(); i++) {
17625        if (array.get(i).isJsonNull()) {
17626          res.getImport().add(new UriType());
17627        } else {
17628          res.getImport().add(parseUri(array.get(i).getAsString()));
17629        }
17630      }
17631    };
17632    if (json.has("_import")) {
17633      JsonArray array = json.getAsJsonArray("_import");
17634      for (int i = 0; i < array.size(); i++) {
17635        if (i == res.getImport().size())
17636          res.getImport().add(parseUri(null));
17637        if (array.get(i) instanceof JsonObject) 
17638          parseElementProperties(array.get(i).getAsJsonObject(), res.getImport().get(i));
17639      }
17640    };
17641    if (json.has("group")) {
17642      JsonArray array = json.getAsJsonArray("group");
17643      for (int i = 0; i < array.size(); i++) {
17644        res.getGroup().add(parseStructureMapStructureMapGroupComponent(array.get(i).getAsJsonObject(), res));
17645      }
17646    };
17647  }
17648
17649  protected StructureMap.StructureMapStructureComponent parseStructureMapStructureMapStructureComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
17650    StructureMap.StructureMapStructureComponent res = new StructureMap.StructureMapStructureComponent();
17651    parseStructureMapStructureMapStructureComponentProperties(json, owner, res);
17652    return res;
17653  }
17654
17655  protected void parseStructureMapStructureMapStructureComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapStructureComponent res) throws IOException, FHIRFormatError {
17656    parseBackboneProperties(json, res);
17657    if (json.has("url"))
17658      res.setUrlElement(parseUri(json.get("url").getAsString()));
17659    if (json.has("_url"))
17660      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
17661    if (json.has("mode"))
17662      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), StructureMap.StructureMapModelMode.NULL, new StructureMap.StructureMapModelModeEnumFactory()));
17663    if (json.has("_mode"))
17664      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
17665    if (json.has("alias"))
17666      res.setAliasElement(parseString(json.get("alias").getAsString()));
17667    if (json.has("_alias"))
17668      parseElementProperties(getJObject(json, "_alias"), res.getAliasElement());
17669    if (json.has("documentation"))
17670      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
17671    if (json.has("_documentation"))
17672      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
17673  }
17674
17675  protected StructureMap.StructureMapGroupComponent parseStructureMapStructureMapGroupComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
17676    StructureMap.StructureMapGroupComponent res = new StructureMap.StructureMapGroupComponent();
17677    parseStructureMapStructureMapGroupComponentProperties(json, owner, res);
17678    return res;
17679  }
17680
17681  protected void parseStructureMapStructureMapGroupComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupComponent res) throws IOException, FHIRFormatError {
17682    parseBackboneProperties(json, res);
17683    if (json.has("name"))
17684      res.setNameElement(parseId(json.get("name").getAsString()));
17685    if (json.has("_name"))
17686      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
17687    if (json.has("extends"))
17688      res.setExtendsElement(parseId(json.get("extends").getAsString()));
17689    if (json.has("_extends"))
17690      parseElementProperties(getJObject(json, "_extends"), res.getExtendsElement());
17691    if (json.has("typeMode"))
17692      res.setTypeModeElement(parseEnumeration(json.get("typeMode").getAsString(), StructureMap.StructureMapGroupTypeMode.NULL, new StructureMap.StructureMapGroupTypeModeEnumFactory()));
17693    if (json.has("_typeMode"))
17694      parseElementProperties(getJObject(json, "_typeMode"), res.getTypeModeElement());
17695    if (json.has("documentation"))
17696      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
17697    if (json.has("_documentation"))
17698      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
17699    if (json.has("input")) {
17700      JsonArray array = json.getAsJsonArray("input");
17701      for (int i = 0; i < array.size(); i++) {
17702        res.getInput().add(parseStructureMapStructureMapGroupInputComponent(array.get(i).getAsJsonObject(), owner));
17703      }
17704    };
17705    if (json.has("rule")) {
17706      JsonArray array = json.getAsJsonArray("rule");
17707      for (int i = 0; i < array.size(); i++) {
17708        res.getRule().add(parseStructureMapStructureMapGroupRuleComponent(array.get(i).getAsJsonObject(), owner));
17709      }
17710    };
17711  }
17712
17713  protected StructureMap.StructureMapGroupInputComponent parseStructureMapStructureMapGroupInputComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
17714    StructureMap.StructureMapGroupInputComponent res = new StructureMap.StructureMapGroupInputComponent();
17715    parseStructureMapStructureMapGroupInputComponentProperties(json, owner, res);
17716    return res;
17717  }
17718
17719  protected void parseStructureMapStructureMapGroupInputComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupInputComponent res) throws IOException, FHIRFormatError {
17720    parseBackboneProperties(json, res);
17721    if (json.has("name"))
17722      res.setNameElement(parseId(json.get("name").getAsString()));
17723    if (json.has("_name"))
17724      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
17725    if (json.has("type"))
17726      res.setTypeElement(parseString(json.get("type").getAsString()));
17727    if (json.has("_type"))
17728      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
17729    if (json.has("mode"))
17730      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), StructureMap.StructureMapInputMode.NULL, new StructureMap.StructureMapInputModeEnumFactory()));
17731    if (json.has("_mode"))
17732      parseElementProperties(getJObject(json, "_mode"), res.getModeElement());
17733    if (json.has("documentation"))
17734      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
17735    if (json.has("_documentation"))
17736      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
17737  }
17738
17739  protected StructureMap.StructureMapGroupRuleComponent parseStructureMapStructureMapGroupRuleComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
17740    StructureMap.StructureMapGroupRuleComponent res = new StructureMap.StructureMapGroupRuleComponent();
17741    parseStructureMapStructureMapGroupRuleComponentProperties(json, owner, res);
17742    return res;
17743  }
17744
17745  protected void parseStructureMapStructureMapGroupRuleComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleComponent res) throws IOException, FHIRFormatError {
17746    parseBackboneProperties(json, res);
17747    if (json.has("name"))
17748      res.setNameElement(parseId(json.get("name").getAsString()));
17749    if (json.has("_name"))
17750      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
17751    if (json.has("source")) {
17752      JsonArray array = json.getAsJsonArray("source");
17753      for (int i = 0; i < array.size(); i++) {
17754        res.getSource().add(parseStructureMapStructureMapGroupRuleSourceComponent(array.get(i).getAsJsonObject(), owner));
17755      }
17756    };
17757    if (json.has("target")) {
17758      JsonArray array = json.getAsJsonArray("target");
17759      for (int i = 0; i < array.size(); i++) {
17760        res.getTarget().add(parseStructureMapStructureMapGroupRuleTargetComponent(array.get(i).getAsJsonObject(), owner));
17761      }
17762    };
17763    if (json.has("rule")) {
17764      JsonArray array = json.getAsJsonArray("rule");
17765      for (int i = 0; i < array.size(); i++) {
17766        res.getRule().add(parseStructureMapStructureMapGroupRuleComponent(array.get(i).getAsJsonObject(), owner));
17767      }
17768    };
17769    if (json.has("dependent")) {
17770      JsonArray array = json.getAsJsonArray("dependent");
17771      for (int i = 0; i < array.size(); i++) {
17772        res.getDependent().add(parseStructureMapStructureMapGroupRuleDependentComponent(array.get(i).getAsJsonObject(), owner));
17773      }
17774    };
17775    if (json.has("documentation"))
17776      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
17777    if (json.has("_documentation"))
17778      parseElementProperties(getJObject(json, "_documentation"), res.getDocumentationElement());
17779  }
17780
17781  protected StructureMap.StructureMapGroupRuleSourceComponent parseStructureMapStructureMapGroupRuleSourceComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
17782    StructureMap.StructureMapGroupRuleSourceComponent res = new StructureMap.StructureMapGroupRuleSourceComponent();
17783    parseStructureMapStructureMapGroupRuleSourceComponentProperties(json, owner, res);
17784    return res;
17785  }
17786
17787  protected void parseStructureMapStructureMapGroupRuleSourceComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleSourceComponent res) throws IOException, FHIRFormatError {
17788    parseBackboneProperties(json, res);
17789    if (json.has("context"))
17790      res.setContextElement(parseId(json.get("context").getAsString()));
17791    if (json.has("_context"))
17792      parseElementProperties(getJObject(json, "_context"), res.getContextElement());
17793    if (json.has("min"))
17794      res.setMinElement(parseInteger(json.get("min").getAsLong()));
17795    if (json.has("_min"))
17796      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
17797    if (json.has("max"))
17798      res.setMaxElement(parseString(json.get("max").getAsString()));
17799    if (json.has("_max"))
17800      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
17801    if (json.has("type"))
17802      res.setTypeElement(parseString(json.get("type").getAsString()));
17803    if (json.has("_type"))
17804      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
17805    Type defaultValue = parseType("defaultValue", json);
17806    if (defaultValue != null)
17807      res.setDefaultValue(defaultValue);
17808    if (json.has("element"))
17809      res.setElementElement(parseString(json.get("element").getAsString()));
17810    if (json.has("_element"))
17811      parseElementProperties(getJObject(json, "_element"), res.getElementElement());
17812    if (json.has("listMode"))
17813      res.setListModeElement(parseEnumeration(json.get("listMode").getAsString(), StructureMap.StructureMapSourceListMode.NULL, new StructureMap.StructureMapSourceListModeEnumFactory()));
17814    if (json.has("_listMode"))
17815      parseElementProperties(getJObject(json, "_listMode"), res.getListModeElement());
17816    if (json.has("variable"))
17817      res.setVariableElement(parseId(json.get("variable").getAsString()));
17818    if (json.has("_variable"))
17819      parseElementProperties(getJObject(json, "_variable"), res.getVariableElement());
17820    if (json.has("condition"))
17821      res.setConditionElement(parseString(json.get("condition").getAsString()));
17822    if (json.has("_condition"))
17823      parseElementProperties(getJObject(json, "_condition"), res.getConditionElement());
17824    if (json.has("check"))
17825      res.setCheckElement(parseString(json.get("check").getAsString()));
17826    if (json.has("_check"))
17827      parseElementProperties(getJObject(json, "_check"), res.getCheckElement());
17828  }
17829
17830  protected StructureMap.StructureMapGroupRuleTargetComponent parseStructureMapStructureMapGroupRuleTargetComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
17831    StructureMap.StructureMapGroupRuleTargetComponent res = new StructureMap.StructureMapGroupRuleTargetComponent();
17832    parseStructureMapStructureMapGroupRuleTargetComponentProperties(json, owner, res);
17833    return res;
17834  }
17835
17836  protected void parseStructureMapStructureMapGroupRuleTargetComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleTargetComponent res) throws IOException, FHIRFormatError {
17837    parseBackboneProperties(json, res);
17838    if (json.has("context"))
17839      res.setContextElement(parseId(json.get("context").getAsString()));
17840    if (json.has("_context"))
17841      parseElementProperties(getJObject(json, "_context"), res.getContextElement());
17842    if (json.has("contextType"))
17843      res.setContextTypeElement(parseEnumeration(json.get("contextType").getAsString(), StructureMap.StructureMapContextType.NULL, new StructureMap.StructureMapContextTypeEnumFactory()));
17844    if (json.has("_contextType"))
17845      parseElementProperties(getJObject(json, "_contextType"), res.getContextTypeElement());
17846    if (json.has("element"))
17847      res.setElementElement(parseString(json.get("element").getAsString()));
17848    if (json.has("_element"))
17849      parseElementProperties(getJObject(json, "_element"), res.getElementElement());
17850    if (json.has("variable"))
17851      res.setVariableElement(parseId(json.get("variable").getAsString()));
17852    if (json.has("_variable"))
17853      parseElementProperties(getJObject(json, "_variable"), res.getVariableElement());
17854    if (json.has("listMode")) {
17855      JsonArray array = json.getAsJsonArray("listMode");
17856      for (int i = 0; i < array.size(); i++) {
17857        if (array.get(i).isJsonNull()) {
17858          res.getListMode().add(new Enumeration<StructureMap.StructureMapTargetListMode>());
17859        } else {
17860          res.getListMode().add(parseEnumeration(array.get(i).getAsString(), StructureMap.StructureMapTargetListMode.NULL, new StructureMap.StructureMapTargetListModeEnumFactory()));
17861        }
17862      }
17863    };
17864    if (json.has("_listMode")) {
17865      JsonArray array = json.getAsJsonArray("_listMode");
17866      for (int i = 0; i < array.size(); i++) {
17867        if (i == res.getListMode().size())
17868          res.getListMode().add(parseEnumeration(null, StructureMap.StructureMapTargetListMode.NULL, new StructureMap.StructureMapTargetListModeEnumFactory()));
17869        if (array.get(i) instanceof JsonObject) 
17870          parseElementProperties(array.get(i).getAsJsonObject(), res.getListMode().get(i));
17871      }
17872    };
17873    if (json.has("listRuleId"))
17874      res.setListRuleIdElement(parseId(json.get("listRuleId").getAsString()));
17875    if (json.has("_listRuleId"))
17876      parseElementProperties(getJObject(json, "_listRuleId"), res.getListRuleIdElement());
17877    if (json.has("transform"))
17878      res.setTransformElement(parseEnumeration(json.get("transform").getAsString(), StructureMap.StructureMapTransform.NULL, new StructureMap.StructureMapTransformEnumFactory()));
17879    if (json.has("_transform"))
17880      parseElementProperties(getJObject(json, "_transform"), res.getTransformElement());
17881    if (json.has("parameter")) {
17882      JsonArray array = json.getAsJsonArray("parameter");
17883      for (int i = 0; i < array.size(); i++) {
17884        res.getParameter().add(parseStructureMapStructureMapGroupRuleTargetParameterComponent(array.get(i).getAsJsonObject(), owner));
17885      }
17886    };
17887  }
17888
17889  protected StructureMap.StructureMapGroupRuleTargetParameterComponent parseStructureMapStructureMapGroupRuleTargetParameterComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
17890    StructureMap.StructureMapGroupRuleTargetParameterComponent res = new StructureMap.StructureMapGroupRuleTargetParameterComponent();
17891    parseStructureMapStructureMapGroupRuleTargetParameterComponentProperties(json, owner, res);
17892    return res;
17893  }
17894
17895  protected void parseStructureMapStructureMapGroupRuleTargetParameterComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleTargetParameterComponent res) throws IOException, FHIRFormatError {
17896    parseBackboneProperties(json, res);
17897    Type value = parseType("value", json);
17898    if (value != null)
17899      res.setValue(value);
17900  }
17901
17902  protected StructureMap.StructureMapGroupRuleDependentComponent parseStructureMapStructureMapGroupRuleDependentComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
17903    StructureMap.StructureMapGroupRuleDependentComponent res = new StructureMap.StructureMapGroupRuleDependentComponent();
17904    parseStructureMapStructureMapGroupRuleDependentComponentProperties(json, owner, res);
17905    return res;
17906  }
17907
17908  protected void parseStructureMapStructureMapGroupRuleDependentComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleDependentComponent res) throws IOException, FHIRFormatError {
17909    parseBackboneProperties(json, res);
17910    if (json.has("name"))
17911      res.setNameElement(parseId(json.get("name").getAsString()));
17912    if (json.has("_name"))
17913      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
17914    if (json.has("variable")) {
17915      JsonArray array = json.getAsJsonArray("variable");
17916      for (int i = 0; i < array.size(); i++) {
17917        if (array.get(i).isJsonNull()) {
17918          res.getVariable().add(new StringType());
17919        } else {
17920          res.getVariable().add(parseString(array.get(i).getAsString()));
17921        }
17922      }
17923    };
17924    if (json.has("_variable")) {
17925      JsonArray array = json.getAsJsonArray("_variable");
17926      for (int i = 0; i < array.size(); i++) {
17927        if (i == res.getVariable().size())
17928          res.getVariable().add(parseString(null));
17929        if (array.get(i) instanceof JsonObject) 
17930          parseElementProperties(array.get(i).getAsJsonObject(), res.getVariable().get(i));
17931      }
17932    };
17933  }
17934
17935  protected Subscription parseSubscription(JsonObject json) throws IOException, FHIRFormatError {
17936    Subscription res = new Subscription();
17937    parseSubscriptionProperties(json, res);
17938    return res;
17939  }
17940
17941  protected void parseSubscriptionProperties(JsonObject json, Subscription res) throws IOException, FHIRFormatError {
17942    parseDomainResourceProperties(json, res);
17943    if (json.has("status"))
17944      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Subscription.SubscriptionStatus.NULL, new Subscription.SubscriptionStatusEnumFactory()));
17945    if (json.has("_status"))
17946      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
17947    if (json.has("contact")) {
17948      JsonArray array = json.getAsJsonArray("contact");
17949      for (int i = 0; i < array.size(); i++) {
17950        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
17951      }
17952    };
17953    if (json.has("end"))
17954      res.setEndElement(parseInstant(json.get("end").getAsString()));
17955    if (json.has("_end"))
17956      parseElementProperties(getJObject(json, "_end"), res.getEndElement());
17957    if (json.has("reason"))
17958      res.setReasonElement(parseString(json.get("reason").getAsString()));
17959    if (json.has("_reason"))
17960      parseElementProperties(getJObject(json, "_reason"), res.getReasonElement());
17961    if (json.has("criteria"))
17962      res.setCriteriaElement(parseString(json.get("criteria").getAsString()));
17963    if (json.has("_criteria"))
17964      parseElementProperties(getJObject(json, "_criteria"), res.getCriteriaElement());
17965    if (json.has("error"))
17966      res.setErrorElement(parseString(json.get("error").getAsString()));
17967    if (json.has("_error"))
17968      parseElementProperties(getJObject(json, "_error"), res.getErrorElement());
17969    if (json.has("channel"))
17970      res.setChannel(parseSubscriptionSubscriptionChannelComponent(getJObject(json, "channel"), res));
17971    if (json.has("tag")) {
17972      JsonArray array = json.getAsJsonArray("tag");
17973      for (int i = 0; i < array.size(); i++) {
17974        res.getTag().add(parseCoding(array.get(i).getAsJsonObject()));
17975      }
17976    };
17977  }
17978
17979  protected Subscription.SubscriptionChannelComponent parseSubscriptionSubscriptionChannelComponent(JsonObject json, Subscription owner) throws IOException, FHIRFormatError {
17980    Subscription.SubscriptionChannelComponent res = new Subscription.SubscriptionChannelComponent();
17981    parseSubscriptionSubscriptionChannelComponentProperties(json, owner, res);
17982    return res;
17983  }
17984
17985  protected void parseSubscriptionSubscriptionChannelComponentProperties(JsonObject json, Subscription owner, Subscription.SubscriptionChannelComponent res) throws IOException, FHIRFormatError {
17986    parseBackboneProperties(json, res);
17987    if (json.has("type"))
17988      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Subscription.SubscriptionChannelType.NULL, new Subscription.SubscriptionChannelTypeEnumFactory()));
17989    if (json.has("_type"))
17990      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
17991    if (json.has("endpoint"))
17992      res.setEndpointElement(parseUri(json.get("endpoint").getAsString()));
17993    if (json.has("_endpoint"))
17994      parseElementProperties(getJObject(json, "_endpoint"), res.getEndpointElement());
17995    if (json.has("payload"))
17996      res.setPayloadElement(parseString(json.get("payload").getAsString()));
17997    if (json.has("_payload"))
17998      parseElementProperties(getJObject(json, "_payload"), res.getPayloadElement());
17999    if (json.has("header")) {
18000      JsonArray array = json.getAsJsonArray("header");
18001      for (int i = 0; i < array.size(); i++) {
18002        if (array.get(i).isJsonNull()) {
18003          res.getHeader().add(new StringType());
18004        } else {
18005          res.getHeader().add(parseString(array.get(i).getAsString()));
18006        }
18007      }
18008    };
18009    if (json.has("_header")) {
18010      JsonArray array = json.getAsJsonArray("_header");
18011      for (int i = 0; i < array.size(); i++) {
18012        if (i == res.getHeader().size())
18013          res.getHeader().add(parseString(null));
18014        if (array.get(i) instanceof JsonObject) 
18015          parseElementProperties(array.get(i).getAsJsonObject(), res.getHeader().get(i));
18016      }
18017    };
18018  }
18019
18020  protected Substance parseSubstance(JsonObject json) throws IOException, FHIRFormatError {
18021    Substance res = new Substance();
18022    parseSubstanceProperties(json, res);
18023    return res;
18024  }
18025
18026  protected void parseSubstanceProperties(JsonObject json, Substance res) throws IOException, FHIRFormatError {
18027    parseDomainResourceProperties(json, res);
18028    if (json.has("identifier")) {
18029      JsonArray array = json.getAsJsonArray("identifier");
18030      for (int i = 0; i < array.size(); i++) {
18031        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18032      }
18033    };
18034    if (json.has("status"))
18035      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Substance.FHIRSubstanceStatus.NULL, new Substance.FHIRSubstanceStatusEnumFactory()));
18036    if (json.has("_status"))
18037      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
18038    if (json.has("category")) {
18039      JsonArray array = json.getAsJsonArray("category");
18040      for (int i = 0; i < array.size(); i++) {
18041        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18042      }
18043    };
18044    if (json.has("code"))
18045      res.setCode(parseCodeableConcept(getJObject(json, "code")));
18046    if (json.has("description"))
18047      res.setDescriptionElement(parseString(json.get("description").getAsString()));
18048    if (json.has("_description"))
18049      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
18050    if (json.has("instance")) {
18051      JsonArray array = json.getAsJsonArray("instance");
18052      for (int i = 0; i < array.size(); i++) {
18053        res.getInstance().add(parseSubstanceSubstanceInstanceComponent(array.get(i).getAsJsonObject(), res));
18054      }
18055    };
18056    if (json.has("ingredient")) {
18057      JsonArray array = json.getAsJsonArray("ingredient");
18058      for (int i = 0; i < array.size(); i++) {
18059        res.getIngredient().add(parseSubstanceSubstanceIngredientComponent(array.get(i).getAsJsonObject(), res));
18060      }
18061    };
18062  }
18063
18064  protected Substance.SubstanceInstanceComponent parseSubstanceSubstanceInstanceComponent(JsonObject json, Substance owner) throws IOException, FHIRFormatError {
18065    Substance.SubstanceInstanceComponent res = new Substance.SubstanceInstanceComponent();
18066    parseSubstanceSubstanceInstanceComponentProperties(json, owner, res);
18067    return res;
18068  }
18069
18070  protected void parseSubstanceSubstanceInstanceComponentProperties(JsonObject json, Substance owner, Substance.SubstanceInstanceComponent res) throws IOException, FHIRFormatError {
18071    parseBackboneProperties(json, res);
18072    if (json.has("identifier"))
18073      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
18074    if (json.has("expiry"))
18075      res.setExpiryElement(parseDateTime(json.get("expiry").getAsString()));
18076    if (json.has("_expiry"))
18077      parseElementProperties(getJObject(json, "_expiry"), res.getExpiryElement());
18078    if (json.has("quantity"))
18079      res.setQuantity(parseSimpleQuantity(getJObject(json, "quantity")));
18080  }
18081
18082  protected Substance.SubstanceIngredientComponent parseSubstanceSubstanceIngredientComponent(JsonObject json, Substance owner) throws IOException, FHIRFormatError {
18083    Substance.SubstanceIngredientComponent res = new Substance.SubstanceIngredientComponent();
18084    parseSubstanceSubstanceIngredientComponentProperties(json, owner, res);
18085    return res;
18086  }
18087
18088  protected void parseSubstanceSubstanceIngredientComponentProperties(JsonObject json, Substance owner, Substance.SubstanceIngredientComponent res) throws IOException, FHIRFormatError {
18089    parseBackboneProperties(json, res);
18090    if (json.has("quantity"))
18091      res.setQuantity(parseRatio(getJObject(json, "quantity")));
18092    Type substance = parseType("substance", json);
18093    if (substance != null)
18094      res.setSubstance(substance);
18095  }
18096
18097  protected SupplyDelivery parseSupplyDelivery(JsonObject json) throws IOException, FHIRFormatError {
18098    SupplyDelivery res = new SupplyDelivery();
18099    parseSupplyDeliveryProperties(json, res);
18100    return res;
18101  }
18102
18103  protected void parseSupplyDeliveryProperties(JsonObject json, SupplyDelivery res) throws IOException, FHIRFormatError {
18104    parseDomainResourceProperties(json, res);
18105    if (json.has("identifier"))
18106      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
18107    if (json.has("basedOn")) {
18108      JsonArray array = json.getAsJsonArray("basedOn");
18109      for (int i = 0; i < array.size(); i++) {
18110        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
18111      }
18112    };
18113    if (json.has("partOf")) {
18114      JsonArray array = json.getAsJsonArray("partOf");
18115      for (int i = 0; i < array.size(); i++) {
18116        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
18117      }
18118    };
18119    if (json.has("status"))
18120      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), SupplyDelivery.SupplyDeliveryStatus.NULL, new SupplyDelivery.SupplyDeliveryStatusEnumFactory()));
18121    if (json.has("_status"))
18122      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
18123    if (json.has("patient"))
18124      res.setPatient(parseReference(getJObject(json, "patient")));
18125    if (json.has("type"))
18126      res.setType(parseCodeableConcept(getJObject(json, "type")));
18127    if (json.has("suppliedItem"))
18128      res.setSuppliedItem(parseSupplyDeliverySupplyDeliverySuppliedItemComponent(getJObject(json, "suppliedItem"), res));
18129    Type occurrence = parseType("occurrence", json);
18130    if (occurrence != null)
18131      res.setOccurrence(occurrence);
18132    if (json.has("supplier"))
18133      res.setSupplier(parseReference(getJObject(json, "supplier")));
18134    if (json.has("destination"))
18135      res.setDestination(parseReference(getJObject(json, "destination")));
18136    if (json.has("receiver")) {
18137      JsonArray array = json.getAsJsonArray("receiver");
18138      for (int i = 0; i < array.size(); i++) {
18139        res.getReceiver().add(parseReference(array.get(i).getAsJsonObject()));
18140      }
18141    };
18142  }
18143
18144  protected SupplyDelivery.SupplyDeliverySuppliedItemComponent parseSupplyDeliverySupplyDeliverySuppliedItemComponent(JsonObject json, SupplyDelivery owner) throws IOException, FHIRFormatError {
18145    SupplyDelivery.SupplyDeliverySuppliedItemComponent res = new SupplyDelivery.SupplyDeliverySuppliedItemComponent();
18146    parseSupplyDeliverySupplyDeliverySuppliedItemComponentProperties(json, owner, res);
18147    return res;
18148  }
18149
18150  protected void parseSupplyDeliverySupplyDeliverySuppliedItemComponentProperties(JsonObject json, SupplyDelivery owner, SupplyDelivery.SupplyDeliverySuppliedItemComponent res) throws IOException, FHIRFormatError {
18151    parseBackboneProperties(json, res);
18152    if (json.has("quantity"))
18153      res.setQuantity(parseSimpleQuantity(getJObject(json, "quantity")));
18154    Type item = parseType("item", json);
18155    if (item != null)
18156      res.setItem(item);
18157  }
18158
18159  protected SupplyRequest parseSupplyRequest(JsonObject json) throws IOException, FHIRFormatError {
18160    SupplyRequest res = new SupplyRequest();
18161    parseSupplyRequestProperties(json, res);
18162    return res;
18163  }
18164
18165  protected void parseSupplyRequestProperties(JsonObject json, SupplyRequest res) throws IOException, FHIRFormatError {
18166    parseDomainResourceProperties(json, res);
18167    if (json.has("identifier"))
18168      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
18169    if (json.has("status"))
18170      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), SupplyRequest.SupplyRequestStatus.NULL, new SupplyRequest.SupplyRequestStatusEnumFactory()));
18171    if (json.has("_status"))
18172      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
18173    if (json.has("category"))
18174      res.setCategory(parseCodeableConcept(getJObject(json, "category")));
18175    if (json.has("priority"))
18176      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), SupplyRequest.RequestPriority.NULL, new SupplyRequest.RequestPriorityEnumFactory()));
18177    if (json.has("_priority"))
18178      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
18179    if (json.has("orderedItem"))
18180      res.setOrderedItem(parseSupplyRequestSupplyRequestOrderedItemComponent(getJObject(json, "orderedItem"), res));
18181    Type occurrence = parseType("occurrence", json);
18182    if (occurrence != null)
18183      res.setOccurrence(occurrence);
18184    if (json.has("authoredOn"))
18185      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
18186    if (json.has("_authoredOn"))
18187      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
18188    if (json.has("requester"))
18189      res.setRequester(parseSupplyRequestSupplyRequestRequesterComponent(getJObject(json, "requester"), res));
18190    if (json.has("supplier")) {
18191      JsonArray array = json.getAsJsonArray("supplier");
18192      for (int i = 0; i < array.size(); i++) {
18193        res.getSupplier().add(parseReference(array.get(i).getAsJsonObject()));
18194      }
18195    };
18196    Type reason = parseType("reason", json);
18197    if (reason != null)
18198      res.setReason(reason);
18199    if (json.has("deliverFrom"))
18200      res.setDeliverFrom(parseReference(getJObject(json, "deliverFrom")));
18201    if (json.has("deliverTo"))
18202      res.setDeliverTo(parseReference(getJObject(json, "deliverTo")));
18203  }
18204
18205  protected SupplyRequest.SupplyRequestOrderedItemComponent parseSupplyRequestSupplyRequestOrderedItemComponent(JsonObject json, SupplyRequest owner) throws IOException, FHIRFormatError {
18206    SupplyRequest.SupplyRequestOrderedItemComponent res = new SupplyRequest.SupplyRequestOrderedItemComponent();
18207    parseSupplyRequestSupplyRequestOrderedItemComponentProperties(json, owner, res);
18208    return res;
18209  }
18210
18211  protected void parseSupplyRequestSupplyRequestOrderedItemComponentProperties(JsonObject json, SupplyRequest owner, SupplyRequest.SupplyRequestOrderedItemComponent res) throws IOException, FHIRFormatError {
18212    parseBackboneProperties(json, res);
18213    if (json.has("quantity"))
18214      res.setQuantity(parseQuantity(getJObject(json, "quantity")));
18215    Type item = parseType("item", json);
18216    if (item != null)
18217      res.setItem(item);
18218  }
18219
18220  protected SupplyRequest.SupplyRequestRequesterComponent parseSupplyRequestSupplyRequestRequesterComponent(JsonObject json, SupplyRequest owner) throws IOException, FHIRFormatError {
18221    SupplyRequest.SupplyRequestRequesterComponent res = new SupplyRequest.SupplyRequestRequesterComponent();
18222    parseSupplyRequestSupplyRequestRequesterComponentProperties(json, owner, res);
18223    return res;
18224  }
18225
18226  protected void parseSupplyRequestSupplyRequestRequesterComponentProperties(JsonObject json, SupplyRequest owner, SupplyRequest.SupplyRequestRequesterComponent res) throws IOException, FHIRFormatError {
18227    parseBackboneProperties(json, res);
18228    if (json.has("agent"))
18229      res.setAgent(parseReference(getJObject(json, "agent")));
18230    if (json.has("onBehalfOf"))
18231      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
18232  }
18233
18234  protected Task parseTask(JsonObject json) throws IOException, FHIRFormatError {
18235    Task res = new Task();
18236    parseTaskProperties(json, res);
18237    return res;
18238  }
18239
18240  protected void parseTaskProperties(JsonObject json, Task res) throws IOException, FHIRFormatError {
18241    parseDomainResourceProperties(json, res);
18242    if (json.has("identifier")) {
18243      JsonArray array = json.getAsJsonArray("identifier");
18244      for (int i = 0; i < array.size(); i++) {
18245        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18246      }
18247    };
18248    Type definition = parseType("definition", json);
18249    if (definition != null)
18250      res.setDefinition(definition);
18251    if (json.has("basedOn")) {
18252      JsonArray array = json.getAsJsonArray("basedOn");
18253      for (int i = 0; i < array.size(); i++) {
18254        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
18255      }
18256    };
18257    if (json.has("groupIdentifier"))
18258      res.setGroupIdentifier(parseIdentifier(getJObject(json, "groupIdentifier")));
18259    if (json.has("partOf")) {
18260      JsonArray array = json.getAsJsonArray("partOf");
18261      for (int i = 0; i < array.size(); i++) {
18262        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
18263      }
18264    };
18265    if (json.has("status"))
18266      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Task.TaskStatus.NULL, new Task.TaskStatusEnumFactory()));
18267    if (json.has("_status"))
18268      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
18269    if (json.has("statusReason"))
18270      res.setStatusReason(parseCodeableConcept(getJObject(json, "statusReason")));
18271    if (json.has("businessStatus"))
18272      res.setBusinessStatus(parseCodeableConcept(getJObject(json, "businessStatus")));
18273    if (json.has("intent"))
18274      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), Task.TaskIntent.NULL, new Task.TaskIntentEnumFactory()));
18275    if (json.has("_intent"))
18276      parseElementProperties(getJObject(json, "_intent"), res.getIntentElement());
18277    if (json.has("priority"))
18278      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Task.TaskPriority.NULL, new Task.TaskPriorityEnumFactory()));
18279    if (json.has("_priority"))
18280      parseElementProperties(getJObject(json, "_priority"), res.getPriorityElement());
18281    if (json.has("code"))
18282      res.setCode(parseCodeableConcept(getJObject(json, "code")));
18283    if (json.has("description"))
18284      res.setDescriptionElement(parseString(json.get("description").getAsString()));
18285    if (json.has("_description"))
18286      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
18287    if (json.has("focus"))
18288      res.setFocus(parseReference(getJObject(json, "focus")));
18289    if (json.has("for"))
18290      res.setFor(parseReference(getJObject(json, "for")));
18291    if (json.has("context"))
18292      res.setContext(parseReference(getJObject(json, "context")));
18293    if (json.has("executionPeriod"))
18294      res.setExecutionPeriod(parsePeriod(getJObject(json, "executionPeriod")));
18295    if (json.has("authoredOn"))
18296      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
18297    if (json.has("_authoredOn"))
18298      parseElementProperties(getJObject(json, "_authoredOn"), res.getAuthoredOnElement());
18299    if (json.has("lastModified"))
18300      res.setLastModifiedElement(parseDateTime(json.get("lastModified").getAsString()));
18301    if (json.has("_lastModified"))
18302      parseElementProperties(getJObject(json, "_lastModified"), res.getLastModifiedElement());
18303    if (json.has("requester"))
18304      res.setRequester(parseTaskTaskRequesterComponent(getJObject(json, "requester"), res));
18305    if (json.has("performerType")) {
18306      JsonArray array = json.getAsJsonArray("performerType");
18307      for (int i = 0; i < array.size(); i++) {
18308        res.getPerformerType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18309      }
18310    };
18311    if (json.has("owner"))
18312      res.setOwner(parseReference(getJObject(json, "owner")));
18313    if (json.has("reason"))
18314      res.setReason(parseCodeableConcept(getJObject(json, "reason")));
18315    if (json.has("note")) {
18316      JsonArray array = json.getAsJsonArray("note");
18317      for (int i = 0; i < array.size(); i++) {
18318        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
18319      }
18320    };
18321    if (json.has("relevantHistory")) {
18322      JsonArray array = json.getAsJsonArray("relevantHistory");
18323      for (int i = 0; i < array.size(); i++) {
18324        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
18325      }
18326    };
18327    if (json.has("restriction"))
18328      res.setRestriction(parseTaskTaskRestrictionComponent(getJObject(json, "restriction"), res));
18329    if (json.has("input")) {
18330      JsonArray array = json.getAsJsonArray("input");
18331      for (int i = 0; i < array.size(); i++) {
18332        res.getInput().add(parseTaskParameterComponent(array.get(i).getAsJsonObject(), res));
18333      }
18334    };
18335    if (json.has("output")) {
18336      JsonArray array = json.getAsJsonArray("output");
18337      for (int i = 0; i < array.size(); i++) {
18338        res.getOutput().add(parseTaskTaskOutputComponent(array.get(i).getAsJsonObject(), res));
18339      }
18340    };
18341  }
18342
18343  protected Task.TaskRequesterComponent parseTaskTaskRequesterComponent(JsonObject json, Task owner) throws IOException, FHIRFormatError {
18344    Task.TaskRequesterComponent res = new Task.TaskRequesterComponent();
18345    parseTaskTaskRequesterComponentProperties(json, owner, res);
18346    return res;
18347  }
18348
18349  protected void parseTaskTaskRequesterComponentProperties(JsonObject json, Task owner, Task.TaskRequesterComponent res) throws IOException, FHIRFormatError {
18350    parseBackboneProperties(json, res);
18351    if (json.has("agent"))
18352      res.setAgent(parseReference(getJObject(json, "agent")));
18353    if (json.has("onBehalfOf"))
18354      res.setOnBehalfOf(parseReference(getJObject(json, "onBehalfOf")));
18355  }
18356
18357  protected Task.TaskRestrictionComponent parseTaskTaskRestrictionComponent(JsonObject json, Task owner) throws IOException, FHIRFormatError {
18358    Task.TaskRestrictionComponent res = new Task.TaskRestrictionComponent();
18359    parseTaskTaskRestrictionComponentProperties(json, owner, res);
18360    return res;
18361  }
18362
18363  protected void parseTaskTaskRestrictionComponentProperties(JsonObject json, Task owner, Task.TaskRestrictionComponent res) throws IOException, FHIRFormatError {
18364    parseBackboneProperties(json, res);
18365    if (json.has("repetitions"))
18366      res.setRepetitionsElement(parsePositiveInt(json.get("repetitions").getAsString()));
18367    if (json.has("_repetitions"))
18368      parseElementProperties(getJObject(json, "_repetitions"), res.getRepetitionsElement());
18369    if (json.has("period"))
18370      res.setPeriod(parsePeriod(getJObject(json, "period")));
18371    if (json.has("recipient")) {
18372      JsonArray array = json.getAsJsonArray("recipient");
18373      for (int i = 0; i < array.size(); i++) {
18374        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
18375      }
18376    };
18377  }
18378
18379  protected Task.ParameterComponent parseTaskParameterComponent(JsonObject json, Task owner) throws IOException, FHIRFormatError {
18380    Task.ParameterComponent res = new Task.ParameterComponent();
18381    parseTaskParameterComponentProperties(json, owner, res);
18382    return res;
18383  }
18384
18385  protected void parseTaskParameterComponentProperties(JsonObject json, Task owner, Task.ParameterComponent res) throws IOException, FHIRFormatError {
18386    parseBackboneProperties(json, res);
18387    if (json.has("type"))
18388      res.setType(parseCodeableConcept(getJObject(json, "type")));
18389    Type value = parseType("value", json);
18390    if (value != null)
18391      res.setValue(value);
18392  }
18393
18394  protected Task.TaskOutputComponent parseTaskTaskOutputComponent(JsonObject json, Task owner) throws IOException, FHIRFormatError {
18395    Task.TaskOutputComponent res = new Task.TaskOutputComponent();
18396    parseTaskTaskOutputComponentProperties(json, owner, res);
18397    return res;
18398  }
18399
18400  protected void parseTaskTaskOutputComponentProperties(JsonObject json, Task owner, Task.TaskOutputComponent res) throws IOException, FHIRFormatError {
18401    parseBackboneProperties(json, res);
18402    if (json.has("type"))
18403      res.setType(parseCodeableConcept(getJObject(json, "type")));
18404    Type value = parseType("value", json);
18405    if (value != null)
18406      res.setValue(value);
18407  }
18408
18409  protected TestReport parseTestReport(JsonObject json) throws IOException, FHIRFormatError {
18410    TestReport res = new TestReport();
18411    parseTestReportProperties(json, res);
18412    return res;
18413  }
18414
18415  protected void parseTestReportProperties(JsonObject json, TestReport res) throws IOException, FHIRFormatError {
18416    parseDomainResourceProperties(json, res);
18417    if (json.has("identifier"))
18418      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
18419    if (json.has("name"))
18420      res.setNameElement(parseString(json.get("name").getAsString()));
18421    if (json.has("_name"))
18422      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
18423    if (json.has("status"))
18424      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), TestReport.TestReportStatus.NULL, new TestReport.TestReportStatusEnumFactory()));
18425    if (json.has("_status"))
18426      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
18427    if (json.has("testScript"))
18428      res.setTestScript(parseReference(getJObject(json, "testScript")));
18429    if (json.has("result"))
18430      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportResult.NULL, new TestReport.TestReportResultEnumFactory()));
18431    if (json.has("_result"))
18432      parseElementProperties(getJObject(json, "_result"), res.getResultElement());
18433    if (json.has("score"))
18434      res.setScoreElement(parseDecimal(json.get("score").getAsBigDecimal()));
18435    if (json.has("_score"))
18436      parseElementProperties(getJObject(json, "_score"), res.getScoreElement());
18437    if (json.has("tester"))
18438      res.setTesterElement(parseString(json.get("tester").getAsString()));
18439    if (json.has("_tester"))
18440      parseElementProperties(getJObject(json, "_tester"), res.getTesterElement());
18441    if (json.has("issued"))
18442      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
18443    if (json.has("_issued"))
18444      parseElementProperties(getJObject(json, "_issued"), res.getIssuedElement());
18445    if (json.has("participant")) {
18446      JsonArray array = json.getAsJsonArray("participant");
18447      for (int i = 0; i < array.size(); i++) {
18448        res.getParticipant().add(parseTestReportTestReportParticipantComponent(array.get(i).getAsJsonObject(), res));
18449      }
18450    };
18451    if (json.has("setup"))
18452      res.setSetup(parseTestReportTestReportSetupComponent(getJObject(json, "setup"), res));
18453    if (json.has("test")) {
18454      JsonArray array = json.getAsJsonArray("test");
18455      for (int i = 0; i < array.size(); i++) {
18456        res.getTest().add(parseTestReportTestReportTestComponent(array.get(i).getAsJsonObject(), res));
18457      }
18458    };
18459    if (json.has("teardown"))
18460      res.setTeardown(parseTestReportTestReportTeardownComponent(getJObject(json, "teardown"), res));
18461  }
18462
18463  protected TestReport.TestReportParticipantComponent parseTestReportTestReportParticipantComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
18464    TestReport.TestReportParticipantComponent res = new TestReport.TestReportParticipantComponent();
18465    parseTestReportTestReportParticipantComponentProperties(json, owner, res);
18466    return res;
18467  }
18468
18469  protected void parseTestReportTestReportParticipantComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportParticipantComponent res) throws IOException, FHIRFormatError {
18470    parseBackboneProperties(json, res);
18471    if (json.has("type"))
18472      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), TestReport.TestReportParticipantType.NULL, new TestReport.TestReportParticipantTypeEnumFactory()));
18473    if (json.has("_type"))
18474      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
18475    if (json.has("uri"))
18476      res.setUriElement(parseUri(json.get("uri").getAsString()));
18477    if (json.has("_uri"))
18478      parseElementProperties(getJObject(json, "_uri"), res.getUriElement());
18479    if (json.has("display"))
18480      res.setDisplayElement(parseString(json.get("display").getAsString()));
18481    if (json.has("_display"))
18482      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
18483  }
18484
18485  protected TestReport.TestReportSetupComponent parseTestReportTestReportSetupComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
18486    TestReport.TestReportSetupComponent res = new TestReport.TestReportSetupComponent();
18487    parseTestReportTestReportSetupComponentProperties(json, owner, res);
18488    return res;
18489  }
18490
18491  protected void parseTestReportTestReportSetupComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportSetupComponent res) throws IOException, FHIRFormatError {
18492    parseBackboneProperties(json, res);
18493    if (json.has("action")) {
18494      JsonArray array = json.getAsJsonArray("action");
18495      for (int i = 0; i < array.size(); i++) {
18496        res.getAction().add(parseTestReportSetupActionComponent(array.get(i).getAsJsonObject(), owner));
18497      }
18498    };
18499  }
18500
18501  protected TestReport.SetupActionComponent parseTestReportSetupActionComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
18502    TestReport.SetupActionComponent res = new TestReport.SetupActionComponent();
18503    parseTestReportSetupActionComponentProperties(json, owner, res);
18504    return res;
18505  }
18506
18507  protected void parseTestReportSetupActionComponentProperties(JsonObject json, TestReport owner, TestReport.SetupActionComponent res) throws IOException, FHIRFormatError {
18508    parseBackboneProperties(json, res);
18509    if (json.has("operation"))
18510      res.setOperation(parseTestReportSetupActionOperationComponent(getJObject(json, "operation"), owner));
18511    if (json.has("assert"))
18512      res.setAssert(parseTestReportSetupActionAssertComponent(getJObject(json, "assert"), owner));
18513  }
18514
18515  protected TestReport.SetupActionOperationComponent parseTestReportSetupActionOperationComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
18516    TestReport.SetupActionOperationComponent res = new TestReport.SetupActionOperationComponent();
18517    parseTestReportSetupActionOperationComponentProperties(json, owner, res);
18518    return res;
18519  }
18520
18521  protected void parseTestReportSetupActionOperationComponentProperties(JsonObject json, TestReport owner, TestReport.SetupActionOperationComponent res) throws IOException, FHIRFormatError {
18522    parseBackboneProperties(json, res);
18523    if (json.has("result"))
18524      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportActionResult.NULL, new TestReport.TestReportActionResultEnumFactory()));
18525    if (json.has("_result"))
18526      parseElementProperties(getJObject(json, "_result"), res.getResultElement());
18527    if (json.has("message"))
18528      res.setMessageElement(parseMarkdown(json.get("message").getAsString()));
18529    if (json.has("_message"))
18530      parseElementProperties(getJObject(json, "_message"), res.getMessageElement());
18531    if (json.has("detail"))
18532      res.setDetailElement(parseUri(json.get("detail").getAsString()));
18533    if (json.has("_detail"))
18534      parseElementProperties(getJObject(json, "_detail"), res.getDetailElement());
18535  }
18536
18537  protected TestReport.SetupActionAssertComponent parseTestReportSetupActionAssertComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
18538    TestReport.SetupActionAssertComponent res = new TestReport.SetupActionAssertComponent();
18539    parseTestReportSetupActionAssertComponentProperties(json, owner, res);
18540    return res;
18541  }
18542
18543  protected void parseTestReportSetupActionAssertComponentProperties(JsonObject json, TestReport owner, TestReport.SetupActionAssertComponent res) throws IOException, FHIRFormatError {
18544    parseBackboneProperties(json, res);
18545    if (json.has("result"))
18546      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportActionResult.NULL, new TestReport.TestReportActionResultEnumFactory()));
18547    if (json.has("_result"))
18548      parseElementProperties(getJObject(json, "_result"), res.getResultElement());
18549    if (json.has("message"))
18550      res.setMessageElement(parseMarkdown(json.get("message").getAsString()));
18551    if (json.has("_message"))
18552      parseElementProperties(getJObject(json, "_message"), res.getMessageElement());
18553    if (json.has("detail"))
18554      res.setDetailElement(parseString(json.get("detail").getAsString()));
18555    if (json.has("_detail"))
18556      parseElementProperties(getJObject(json, "_detail"), res.getDetailElement());
18557  }
18558
18559  protected TestReport.TestReportTestComponent parseTestReportTestReportTestComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
18560    TestReport.TestReportTestComponent res = new TestReport.TestReportTestComponent();
18561    parseTestReportTestReportTestComponentProperties(json, owner, res);
18562    return res;
18563  }
18564
18565  protected void parseTestReportTestReportTestComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportTestComponent res) throws IOException, FHIRFormatError {
18566    parseBackboneProperties(json, res);
18567    if (json.has("name"))
18568      res.setNameElement(parseString(json.get("name").getAsString()));
18569    if (json.has("_name"))
18570      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
18571    if (json.has("description"))
18572      res.setDescriptionElement(parseString(json.get("description").getAsString()));
18573    if (json.has("_description"))
18574      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
18575    if (json.has("action")) {
18576      JsonArray array = json.getAsJsonArray("action");
18577      for (int i = 0; i < array.size(); i++) {
18578        res.getAction().add(parseTestReportTestActionComponent(array.get(i).getAsJsonObject(), owner));
18579      }
18580    };
18581  }
18582
18583  protected TestReport.TestActionComponent parseTestReportTestActionComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
18584    TestReport.TestActionComponent res = new TestReport.TestActionComponent();
18585    parseTestReportTestActionComponentProperties(json, owner, res);
18586    return res;
18587  }
18588
18589  protected void parseTestReportTestActionComponentProperties(JsonObject json, TestReport owner, TestReport.TestActionComponent res) throws IOException, FHIRFormatError {
18590    parseBackboneProperties(json, res);
18591    if (json.has("operation"))
18592      res.setOperation(parseTestReportSetupActionOperationComponent(getJObject(json, "operation"), owner));
18593    if (json.has("assert"))
18594      res.setAssert(parseTestReportSetupActionAssertComponent(getJObject(json, "assert"), owner));
18595  }
18596
18597  protected TestReport.TestReportTeardownComponent parseTestReportTestReportTeardownComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
18598    TestReport.TestReportTeardownComponent res = new TestReport.TestReportTeardownComponent();
18599    parseTestReportTestReportTeardownComponentProperties(json, owner, res);
18600    return res;
18601  }
18602
18603  protected void parseTestReportTestReportTeardownComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportTeardownComponent res) throws IOException, FHIRFormatError {
18604    parseBackboneProperties(json, res);
18605    if (json.has("action")) {
18606      JsonArray array = json.getAsJsonArray("action");
18607      for (int i = 0; i < array.size(); i++) {
18608        res.getAction().add(parseTestReportTeardownActionComponent(array.get(i).getAsJsonObject(), owner));
18609      }
18610    };
18611  }
18612
18613  protected TestReport.TeardownActionComponent parseTestReportTeardownActionComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
18614    TestReport.TeardownActionComponent res = new TestReport.TeardownActionComponent();
18615    parseTestReportTeardownActionComponentProperties(json, owner, res);
18616    return res;
18617  }
18618
18619  protected void parseTestReportTeardownActionComponentProperties(JsonObject json, TestReport owner, TestReport.TeardownActionComponent res) throws IOException, FHIRFormatError {
18620    parseBackboneProperties(json, res);
18621    if (json.has("operation"))
18622      res.setOperation(parseTestReportSetupActionOperationComponent(getJObject(json, "operation"), owner));
18623  }
18624
18625  protected TestScript parseTestScript(JsonObject json) throws IOException, FHIRFormatError {
18626    TestScript res = new TestScript();
18627    parseTestScriptProperties(json, res);
18628    return res;
18629  }
18630
18631  protected void parseTestScriptProperties(JsonObject json, TestScript res) throws IOException, FHIRFormatError {
18632    parseDomainResourceProperties(json, res);
18633    if (json.has("url"))
18634      res.setUrlElement(parseUri(json.get("url").getAsString()));
18635    if (json.has("_url"))
18636      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
18637    if (json.has("identifier"))
18638      res.setIdentifier(parseIdentifier(getJObject(json, "identifier")));
18639    if (json.has("version"))
18640      res.setVersionElement(parseString(json.get("version").getAsString()));
18641    if (json.has("_version"))
18642      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
18643    if (json.has("name"))
18644      res.setNameElement(parseString(json.get("name").getAsString()));
18645    if (json.has("_name"))
18646      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
18647    if (json.has("title"))
18648      res.setTitleElement(parseString(json.get("title").getAsString()));
18649    if (json.has("_title"))
18650      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
18651    if (json.has("status"))
18652      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
18653    if (json.has("_status"))
18654      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
18655    if (json.has("experimental"))
18656      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
18657    if (json.has("_experimental"))
18658      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
18659    if (json.has("date"))
18660      res.setDateElement(parseDateTime(json.get("date").getAsString()));
18661    if (json.has("_date"))
18662      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
18663    if (json.has("publisher"))
18664      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
18665    if (json.has("_publisher"))
18666      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
18667    if (json.has("contact")) {
18668      JsonArray array = json.getAsJsonArray("contact");
18669      for (int i = 0; i < array.size(); i++) {
18670        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
18671      }
18672    };
18673    if (json.has("description"))
18674      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
18675    if (json.has("_description"))
18676      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
18677    if (json.has("useContext")) {
18678      JsonArray array = json.getAsJsonArray("useContext");
18679      for (int i = 0; i < array.size(); i++) {
18680        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
18681      }
18682    };
18683    if (json.has("jurisdiction")) {
18684      JsonArray array = json.getAsJsonArray("jurisdiction");
18685      for (int i = 0; i < array.size(); i++) {
18686        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18687      }
18688    };
18689    if (json.has("purpose"))
18690      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
18691    if (json.has("_purpose"))
18692      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
18693    if (json.has("copyright"))
18694      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
18695    if (json.has("_copyright"))
18696      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
18697    if (json.has("origin")) {
18698      JsonArray array = json.getAsJsonArray("origin");
18699      for (int i = 0; i < array.size(); i++) {
18700        res.getOrigin().add(parseTestScriptTestScriptOriginComponent(array.get(i).getAsJsonObject(), res));
18701      }
18702    };
18703    if (json.has("destination")) {
18704      JsonArray array = json.getAsJsonArray("destination");
18705      for (int i = 0; i < array.size(); i++) {
18706        res.getDestination().add(parseTestScriptTestScriptDestinationComponent(array.get(i).getAsJsonObject(), res));
18707      }
18708    };
18709    if (json.has("metadata"))
18710      res.setMetadata(parseTestScriptTestScriptMetadataComponent(getJObject(json, "metadata"), res));
18711    if (json.has("fixture")) {
18712      JsonArray array = json.getAsJsonArray("fixture");
18713      for (int i = 0; i < array.size(); i++) {
18714        res.getFixture().add(parseTestScriptTestScriptFixtureComponent(array.get(i).getAsJsonObject(), res));
18715      }
18716    };
18717    if (json.has("profile")) {
18718      JsonArray array = json.getAsJsonArray("profile");
18719      for (int i = 0; i < array.size(); i++) {
18720        res.getProfile().add(parseReference(array.get(i).getAsJsonObject()));
18721      }
18722    };
18723    if (json.has("variable")) {
18724      JsonArray array = json.getAsJsonArray("variable");
18725      for (int i = 0; i < array.size(); i++) {
18726        res.getVariable().add(parseTestScriptTestScriptVariableComponent(array.get(i).getAsJsonObject(), res));
18727      }
18728    };
18729    if (json.has("rule")) {
18730      JsonArray array = json.getAsJsonArray("rule");
18731      for (int i = 0; i < array.size(); i++) {
18732        res.getRule().add(parseTestScriptTestScriptRuleComponent(array.get(i).getAsJsonObject(), res));
18733      }
18734    };
18735    if (json.has("ruleset")) {
18736      JsonArray array = json.getAsJsonArray("ruleset");
18737      for (int i = 0; i < array.size(); i++) {
18738        res.getRuleset().add(parseTestScriptTestScriptRulesetComponent(array.get(i).getAsJsonObject(), res));
18739      }
18740    };
18741    if (json.has("setup"))
18742      res.setSetup(parseTestScriptTestScriptSetupComponent(getJObject(json, "setup"), res));
18743    if (json.has("test")) {
18744      JsonArray array = json.getAsJsonArray("test");
18745      for (int i = 0; i < array.size(); i++) {
18746        res.getTest().add(parseTestScriptTestScriptTestComponent(array.get(i).getAsJsonObject(), res));
18747      }
18748    };
18749    if (json.has("teardown"))
18750      res.setTeardown(parseTestScriptTestScriptTeardownComponent(getJObject(json, "teardown"), res));
18751  }
18752
18753  protected TestScript.TestScriptOriginComponent parseTestScriptTestScriptOriginComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18754    TestScript.TestScriptOriginComponent res = new TestScript.TestScriptOriginComponent();
18755    parseTestScriptTestScriptOriginComponentProperties(json, owner, res);
18756    return res;
18757  }
18758
18759  protected void parseTestScriptTestScriptOriginComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptOriginComponent res) throws IOException, FHIRFormatError {
18760    parseBackboneProperties(json, res);
18761    if (json.has("index"))
18762      res.setIndexElement(parseInteger(json.get("index").getAsLong()));
18763    if (json.has("_index"))
18764      parseElementProperties(getJObject(json, "_index"), res.getIndexElement());
18765    if (json.has("profile"))
18766      res.setProfile(parseCoding(getJObject(json, "profile")));
18767  }
18768
18769  protected TestScript.TestScriptDestinationComponent parseTestScriptTestScriptDestinationComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18770    TestScript.TestScriptDestinationComponent res = new TestScript.TestScriptDestinationComponent();
18771    parseTestScriptTestScriptDestinationComponentProperties(json, owner, res);
18772    return res;
18773  }
18774
18775  protected void parseTestScriptTestScriptDestinationComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptDestinationComponent res) throws IOException, FHIRFormatError {
18776    parseBackboneProperties(json, res);
18777    if (json.has("index"))
18778      res.setIndexElement(parseInteger(json.get("index").getAsLong()));
18779    if (json.has("_index"))
18780      parseElementProperties(getJObject(json, "_index"), res.getIndexElement());
18781    if (json.has("profile"))
18782      res.setProfile(parseCoding(getJObject(json, "profile")));
18783  }
18784
18785  protected TestScript.TestScriptMetadataComponent parseTestScriptTestScriptMetadataComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18786    TestScript.TestScriptMetadataComponent res = new TestScript.TestScriptMetadataComponent();
18787    parseTestScriptTestScriptMetadataComponentProperties(json, owner, res);
18788    return res;
18789  }
18790
18791  protected void parseTestScriptTestScriptMetadataComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptMetadataComponent res) throws IOException, FHIRFormatError {
18792    parseBackboneProperties(json, res);
18793    if (json.has("link")) {
18794      JsonArray array = json.getAsJsonArray("link");
18795      for (int i = 0; i < array.size(); i++) {
18796        res.getLink().add(parseTestScriptTestScriptMetadataLinkComponent(array.get(i).getAsJsonObject(), owner));
18797      }
18798    };
18799    if (json.has("capability")) {
18800      JsonArray array = json.getAsJsonArray("capability");
18801      for (int i = 0; i < array.size(); i++) {
18802        res.getCapability().add(parseTestScriptTestScriptMetadataCapabilityComponent(array.get(i).getAsJsonObject(), owner));
18803      }
18804    };
18805  }
18806
18807  protected TestScript.TestScriptMetadataLinkComponent parseTestScriptTestScriptMetadataLinkComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18808    TestScript.TestScriptMetadataLinkComponent res = new TestScript.TestScriptMetadataLinkComponent();
18809    parseTestScriptTestScriptMetadataLinkComponentProperties(json, owner, res);
18810    return res;
18811  }
18812
18813  protected void parseTestScriptTestScriptMetadataLinkComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptMetadataLinkComponent res) throws IOException, FHIRFormatError {
18814    parseBackboneProperties(json, res);
18815    if (json.has("url"))
18816      res.setUrlElement(parseUri(json.get("url").getAsString()));
18817    if (json.has("_url"))
18818      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
18819    if (json.has("description"))
18820      res.setDescriptionElement(parseString(json.get("description").getAsString()));
18821    if (json.has("_description"))
18822      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
18823  }
18824
18825  protected TestScript.TestScriptMetadataCapabilityComponent parseTestScriptTestScriptMetadataCapabilityComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18826    TestScript.TestScriptMetadataCapabilityComponent res = new TestScript.TestScriptMetadataCapabilityComponent();
18827    parseTestScriptTestScriptMetadataCapabilityComponentProperties(json, owner, res);
18828    return res;
18829  }
18830
18831  protected void parseTestScriptTestScriptMetadataCapabilityComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptMetadataCapabilityComponent res) throws IOException, FHIRFormatError {
18832    parseBackboneProperties(json, res);
18833    if (json.has("required"))
18834      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
18835    if (json.has("_required"))
18836      parseElementProperties(getJObject(json, "_required"), res.getRequiredElement());
18837    if (json.has("validated"))
18838      res.setValidatedElement(parseBoolean(json.get("validated").getAsBoolean()));
18839    if (json.has("_validated"))
18840      parseElementProperties(getJObject(json, "_validated"), res.getValidatedElement());
18841    if (json.has("description"))
18842      res.setDescriptionElement(parseString(json.get("description").getAsString()));
18843    if (json.has("_description"))
18844      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
18845    if (json.has("origin")) {
18846      JsonArray array = json.getAsJsonArray("origin");
18847      for (int i = 0; i < array.size(); i++) {
18848        if (array.get(i).isJsonNull()) {
18849          res.getOrigin().add(new IntegerType());
18850        } else {
18851          res.getOrigin().add(parseInteger(array.get(i).getAsLong()));
18852        }
18853      }
18854    };
18855    if (json.has("_origin")) {
18856      JsonArray array = json.getAsJsonArray("_origin");
18857      for (int i = 0; i < array.size(); i++) {
18858        if (i == res.getOrigin().size())
18859          res.getOrigin().add(parseInteger(null));
18860        if (array.get(i) instanceof JsonObject) 
18861          parseElementProperties(array.get(i).getAsJsonObject(), res.getOrigin().get(i));
18862      }
18863    };
18864    if (json.has("destination"))
18865      res.setDestinationElement(parseInteger(json.get("destination").getAsLong()));
18866    if (json.has("_destination"))
18867      parseElementProperties(getJObject(json, "_destination"), res.getDestinationElement());
18868    if (json.has("link")) {
18869      JsonArray array = json.getAsJsonArray("link");
18870      for (int i = 0; i < array.size(); i++) {
18871        if (array.get(i).isJsonNull()) {
18872          res.getLink().add(new UriType());
18873        } else {
18874          res.getLink().add(parseUri(array.get(i).getAsString()));
18875        }
18876      }
18877    };
18878    if (json.has("_link")) {
18879      JsonArray array = json.getAsJsonArray("_link");
18880      for (int i = 0; i < array.size(); i++) {
18881        if (i == res.getLink().size())
18882          res.getLink().add(parseUri(null));
18883        if (array.get(i) instanceof JsonObject) 
18884          parseElementProperties(array.get(i).getAsJsonObject(), res.getLink().get(i));
18885      }
18886    };
18887    if (json.has("capabilities"))
18888      res.setCapabilities(parseReference(getJObject(json, "capabilities")));
18889  }
18890
18891  protected TestScript.TestScriptFixtureComponent parseTestScriptTestScriptFixtureComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18892    TestScript.TestScriptFixtureComponent res = new TestScript.TestScriptFixtureComponent();
18893    parseTestScriptTestScriptFixtureComponentProperties(json, owner, res);
18894    return res;
18895  }
18896
18897  protected void parseTestScriptTestScriptFixtureComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptFixtureComponent res) throws IOException, FHIRFormatError {
18898    parseBackboneProperties(json, res);
18899    if (json.has("autocreate"))
18900      res.setAutocreateElement(parseBoolean(json.get("autocreate").getAsBoolean()));
18901    if (json.has("_autocreate"))
18902      parseElementProperties(getJObject(json, "_autocreate"), res.getAutocreateElement());
18903    if (json.has("autodelete"))
18904      res.setAutodeleteElement(parseBoolean(json.get("autodelete").getAsBoolean()));
18905    if (json.has("_autodelete"))
18906      parseElementProperties(getJObject(json, "_autodelete"), res.getAutodeleteElement());
18907    if (json.has("resource"))
18908      res.setResource(parseReference(getJObject(json, "resource")));
18909  }
18910
18911  protected TestScript.TestScriptVariableComponent parseTestScriptTestScriptVariableComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18912    TestScript.TestScriptVariableComponent res = new TestScript.TestScriptVariableComponent();
18913    parseTestScriptTestScriptVariableComponentProperties(json, owner, res);
18914    return res;
18915  }
18916
18917  protected void parseTestScriptTestScriptVariableComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptVariableComponent res) throws IOException, FHIRFormatError {
18918    parseBackboneProperties(json, res);
18919    if (json.has("name"))
18920      res.setNameElement(parseString(json.get("name").getAsString()));
18921    if (json.has("_name"))
18922      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
18923    if (json.has("defaultValue"))
18924      res.setDefaultValueElement(parseString(json.get("defaultValue").getAsString()));
18925    if (json.has("_defaultValue"))
18926      parseElementProperties(getJObject(json, "_defaultValue"), res.getDefaultValueElement());
18927    if (json.has("description"))
18928      res.setDescriptionElement(parseString(json.get("description").getAsString()));
18929    if (json.has("_description"))
18930      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
18931    if (json.has("expression"))
18932      res.setExpressionElement(parseString(json.get("expression").getAsString()));
18933    if (json.has("_expression"))
18934      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
18935    if (json.has("headerField"))
18936      res.setHeaderFieldElement(parseString(json.get("headerField").getAsString()));
18937    if (json.has("_headerField"))
18938      parseElementProperties(getJObject(json, "_headerField"), res.getHeaderFieldElement());
18939    if (json.has("hint"))
18940      res.setHintElement(parseString(json.get("hint").getAsString()));
18941    if (json.has("_hint"))
18942      parseElementProperties(getJObject(json, "_hint"), res.getHintElement());
18943    if (json.has("path"))
18944      res.setPathElement(parseString(json.get("path").getAsString()));
18945    if (json.has("_path"))
18946      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
18947    if (json.has("sourceId"))
18948      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
18949    if (json.has("_sourceId"))
18950      parseElementProperties(getJObject(json, "_sourceId"), res.getSourceIdElement());
18951  }
18952
18953  protected TestScript.TestScriptRuleComponent parseTestScriptTestScriptRuleComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18954    TestScript.TestScriptRuleComponent res = new TestScript.TestScriptRuleComponent();
18955    parseTestScriptTestScriptRuleComponentProperties(json, owner, res);
18956    return res;
18957  }
18958
18959  protected void parseTestScriptTestScriptRuleComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptRuleComponent res) throws IOException, FHIRFormatError {
18960    parseBackboneProperties(json, res);
18961    if (json.has("resource"))
18962      res.setResource(parseReference(getJObject(json, "resource")));
18963    if (json.has("param")) {
18964      JsonArray array = json.getAsJsonArray("param");
18965      for (int i = 0; i < array.size(); i++) {
18966        res.getParam().add(parseTestScriptRuleParamComponent(array.get(i).getAsJsonObject(), owner));
18967      }
18968    };
18969  }
18970
18971  protected TestScript.RuleParamComponent parseTestScriptRuleParamComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18972    TestScript.RuleParamComponent res = new TestScript.RuleParamComponent();
18973    parseTestScriptRuleParamComponentProperties(json, owner, res);
18974    return res;
18975  }
18976
18977  protected void parseTestScriptRuleParamComponentProperties(JsonObject json, TestScript owner, TestScript.RuleParamComponent res) throws IOException, FHIRFormatError {
18978    parseBackboneProperties(json, res);
18979    if (json.has("name"))
18980      res.setNameElement(parseString(json.get("name").getAsString()));
18981    if (json.has("_name"))
18982      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
18983    if (json.has("value"))
18984      res.setValueElement(parseString(json.get("value").getAsString()));
18985    if (json.has("_value"))
18986      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
18987  }
18988
18989  protected TestScript.TestScriptRulesetComponent parseTestScriptTestScriptRulesetComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18990    TestScript.TestScriptRulesetComponent res = new TestScript.TestScriptRulesetComponent();
18991    parseTestScriptTestScriptRulesetComponentProperties(json, owner, res);
18992    return res;
18993  }
18994
18995  protected void parseTestScriptTestScriptRulesetComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptRulesetComponent res) throws IOException, FHIRFormatError {
18996    parseBackboneProperties(json, res);
18997    if (json.has("resource"))
18998      res.setResource(parseReference(getJObject(json, "resource")));
18999    if (json.has("rule")) {
19000      JsonArray array = json.getAsJsonArray("rule");
19001      for (int i = 0; i < array.size(); i++) {
19002        res.getRule().add(parseTestScriptRulesetRuleComponent(array.get(i).getAsJsonObject(), owner));
19003      }
19004    };
19005  }
19006
19007  protected TestScript.RulesetRuleComponent parseTestScriptRulesetRuleComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
19008    TestScript.RulesetRuleComponent res = new TestScript.RulesetRuleComponent();
19009    parseTestScriptRulesetRuleComponentProperties(json, owner, res);
19010    return res;
19011  }
19012
19013  protected void parseTestScriptRulesetRuleComponentProperties(JsonObject json, TestScript owner, TestScript.RulesetRuleComponent res) throws IOException, FHIRFormatError {
19014    parseBackboneProperties(json, res);
19015    if (json.has("ruleId"))
19016      res.setRuleIdElement(parseId(json.get("ruleId").getAsString()));
19017    if (json.has("_ruleId"))
19018      parseElementProperties(getJObject(json, "_ruleId"), res.getRuleIdElement());
19019    if (json.has("param")) {
19020      JsonArray array = json.getAsJsonArray("param");
19021      for (int i = 0; i < array.size(); i++) {
19022        res.getParam().add(parseTestScriptRulesetRuleParamComponent(array.get(i).getAsJsonObject(), owner));
19023      }
19024    };
19025  }
19026
19027  protected TestScript.RulesetRuleParamComponent parseTestScriptRulesetRuleParamComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
19028    TestScript.RulesetRuleParamComponent res = new TestScript.RulesetRuleParamComponent();
19029    parseTestScriptRulesetRuleParamComponentProperties(json, owner, res);
19030    return res;
19031  }
19032
19033  protected void parseTestScriptRulesetRuleParamComponentProperties(JsonObject json, TestScript owner, TestScript.RulesetRuleParamComponent res) throws IOException, FHIRFormatError {
19034    parseBackboneProperties(json, res);
19035    if (json.has("name"))
19036      res.setNameElement(parseString(json.get("name").getAsString()));
19037    if (json.has("_name"))
19038      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
19039    if (json.has("value"))
19040      res.setValueElement(parseString(json.get("value").getAsString()));
19041    if (json.has("_value"))
19042      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
19043  }
19044
19045  protected TestScript.TestScriptSetupComponent parseTestScriptTestScriptSetupComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
19046    TestScript.TestScriptSetupComponent res = new TestScript.TestScriptSetupComponent();
19047    parseTestScriptTestScriptSetupComponentProperties(json, owner, res);
19048    return res;
19049  }
19050
19051  protected void parseTestScriptTestScriptSetupComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptSetupComponent res) throws IOException, FHIRFormatError {
19052    parseBackboneProperties(json, res);
19053    if (json.has("action")) {
19054      JsonArray array = json.getAsJsonArray("action");
19055      for (int i = 0; i < array.size(); i++) {
19056        res.getAction().add(parseTestScriptSetupActionComponent(array.get(i).getAsJsonObject(), owner));
19057      }
19058    };
19059  }
19060
19061  protected TestScript.SetupActionComponent parseTestScriptSetupActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
19062    TestScript.SetupActionComponent res = new TestScript.SetupActionComponent();
19063    parseTestScriptSetupActionComponentProperties(json, owner, res);
19064    return res;
19065  }
19066
19067  protected void parseTestScriptSetupActionComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionComponent res) throws IOException, FHIRFormatError {
19068    parseBackboneProperties(json, res);
19069    if (json.has("operation"))
19070      res.setOperation(parseTestScriptSetupActionOperationComponent(getJObject(json, "operation"), owner));
19071    if (json.has("assert"))
19072      res.setAssert(parseTestScriptSetupActionAssertComponent(getJObject(json, "assert"), owner));
19073  }
19074
19075  protected TestScript.SetupActionOperationComponent parseTestScriptSetupActionOperationComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
19076    TestScript.SetupActionOperationComponent res = new TestScript.SetupActionOperationComponent();
19077    parseTestScriptSetupActionOperationComponentProperties(json, owner, res);
19078    return res;
19079  }
19080
19081  protected void parseTestScriptSetupActionOperationComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionOperationComponent res) throws IOException, FHIRFormatError {
19082    parseBackboneProperties(json, res);
19083    if (json.has("type"))
19084      res.setType(parseCoding(getJObject(json, "type")));
19085    if (json.has("resource"))
19086      res.setResourceElement(parseCode(json.get("resource").getAsString()));
19087    if (json.has("_resource"))
19088      parseElementProperties(getJObject(json, "_resource"), res.getResourceElement());
19089    if (json.has("label"))
19090      res.setLabelElement(parseString(json.get("label").getAsString()));
19091    if (json.has("_label"))
19092      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
19093    if (json.has("description"))
19094      res.setDescriptionElement(parseString(json.get("description").getAsString()));
19095    if (json.has("_description"))
19096      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
19097    if (json.has("accept"))
19098      res.setAcceptElement(parseEnumeration(json.get("accept").getAsString(), TestScript.ContentType.NULL, new TestScript.ContentTypeEnumFactory()));
19099    if (json.has("_accept"))
19100      parseElementProperties(getJObject(json, "_accept"), res.getAcceptElement());
19101    if (json.has("contentType"))
19102      res.setContentTypeElement(parseEnumeration(json.get("contentType").getAsString(), TestScript.ContentType.NULL, new TestScript.ContentTypeEnumFactory()));
19103    if (json.has("_contentType"))
19104      parseElementProperties(getJObject(json, "_contentType"), res.getContentTypeElement());
19105    if (json.has("destination"))
19106      res.setDestinationElement(parseInteger(json.get("destination").getAsLong()));
19107    if (json.has("_destination"))
19108      parseElementProperties(getJObject(json, "_destination"), res.getDestinationElement());
19109    if (json.has("encodeRequestUrl"))
19110      res.setEncodeRequestUrlElement(parseBoolean(json.get("encodeRequestUrl").getAsBoolean()));
19111    if (json.has("_encodeRequestUrl"))
19112      parseElementProperties(getJObject(json, "_encodeRequestUrl"), res.getEncodeRequestUrlElement());
19113    if (json.has("origin"))
19114      res.setOriginElement(parseInteger(json.get("origin").getAsLong()));
19115    if (json.has("_origin"))
19116      parseElementProperties(getJObject(json, "_origin"), res.getOriginElement());
19117    if (json.has("params"))
19118      res.setParamsElement(parseString(json.get("params").getAsString()));
19119    if (json.has("_params"))
19120      parseElementProperties(getJObject(json, "_params"), res.getParamsElement());
19121    if (json.has("requestHeader")) {
19122      JsonArray array = json.getAsJsonArray("requestHeader");
19123      for (int i = 0; i < array.size(); i++) {
19124        res.getRequestHeader().add(parseTestScriptSetupActionOperationRequestHeaderComponent(array.get(i).getAsJsonObject(), owner));
19125      }
19126    };
19127    if (json.has("requestId"))
19128      res.setRequestIdElement(parseId(json.get("requestId").getAsString()));
19129    if (json.has("_requestId"))
19130      parseElementProperties(getJObject(json, "_requestId"), res.getRequestIdElement());
19131    if (json.has("responseId"))
19132      res.setResponseIdElement(parseId(json.get("responseId").getAsString()));
19133    if (json.has("_responseId"))
19134      parseElementProperties(getJObject(json, "_responseId"), res.getResponseIdElement());
19135    if (json.has("sourceId"))
19136      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
19137    if (json.has("_sourceId"))
19138      parseElementProperties(getJObject(json, "_sourceId"), res.getSourceIdElement());
19139    if (json.has("targetId"))
19140      res.setTargetIdElement(parseId(json.get("targetId").getAsString()));
19141    if (json.has("_targetId"))
19142      parseElementProperties(getJObject(json, "_targetId"), res.getTargetIdElement());
19143    if (json.has("url"))
19144      res.setUrlElement(parseString(json.get("url").getAsString()));
19145    if (json.has("_url"))
19146      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
19147  }
19148
19149  protected TestScript.SetupActionOperationRequestHeaderComponent parseTestScriptSetupActionOperationRequestHeaderComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
19150    TestScript.SetupActionOperationRequestHeaderComponent res = new TestScript.SetupActionOperationRequestHeaderComponent();
19151    parseTestScriptSetupActionOperationRequestHeaderComponentProperties(json, owner, res);
19152    return res;
19153  }
19154
19155  protected void parseTestScriptSetupActionOperationRequestHeaderComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionOperationRequestHeaderComponent res) throws IOException, FHIRFormatError {
19156    parseBackboneProperties(json, res);
19157    if (json.has("field"))
19158      res.setFieldElement(parseString(json.get("field").getAsString()));
19159    if (json.has("_field"))
19160      parseElementProperties(getJObject(json, "_field"), res.getFieldElement());
19161    if (json.has("value"))
19162      res.setValueElement(parseString(json.get("value").getAsString()));
19163    if (json.has("_value"))
19164      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
19165  }
19166
19167  protected TestScript.SetupActionAssertComponent parseTestScriptSetupActionAssertComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
19168    TestScript.SetupActionAssertComponent res = new TestScript.SetupActionAssertComponent();
19169    parseTestScriptSetupActionAssertComponentProperties(json, owner, res);
19170    return res;
19171  }
19172
19173  protected void parseTestScriptSetupActionAssertComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionAssertComponent res) throws IOException, FHIRFormatError {
19174    parseBackboneProperties(json, res);
19175    if (json.has("label"))
19176      res.setLabelElement(parseString(json.get("label").getAsString()));
19177    if (json.has("_label"))
19178      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
19179    if (json.has("description"))
19180      res.setDescriptionElement(parseString(json.get("description").getAsString()));
19181    if (json.has("_description"))
19182      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
19183    if (json.has("direction"))
19184      res.setDirectionElement(parseEnumeration(json.get("direction").getAsString(), TestScript.AssertionDirectionType.NULL, new TestScript.AssertionDirectionTypeEnumFactory()));
19185    if (json.has("_direction"))
19186      parseElementProperties(getJObject(json, "_direction"), res.getDirectionElement());
19187    if (json.has("compareToSourceId"))
19188      res.setCompareToSourceIdElement(parseString(json.get("compareToSourceId").getAsString()));
19189    if (json.has("_compareToSourceId"))
19190      parseElementProperties(getJObject(json, "_compareToSourceId"), res.getCompareToSourceIdElement());
19191    if (json.has("compareToSourceExpression"))
19192      res.setCompareToSourceExpressionElement(parseString(json.get("compareToSourceExpression").getAsString()));
19193    if (json.has("_compareToSourceExpression"))
19194      parseElementProperties(getJObject(json, "_compareToSourceExpression"), res.getCompareToSourceExpressionElement());
19195    if (json.has("compareToSourcePath"))
19196      res.setCompareToSourcePathElement(parseString(json.get("compareToSourcePath").getAsString()));
19197    if (json.has("_compareToSourcePath"))
19198      parseElementProperties(getJObject(json, "_compareToSourcePath"), res.getCompareToSourcePathElement());
19199    if (json.has("contentType"))
19200      res.setContentTypeElement(parseEnumeration(json.get("contentType").getAsString(), TestScript.ContentType.NULL, new TestScript.ContentTypeEnumFactory()));
19201    if (json.has("_contentType"))
19202      parseElementProperties(getJObject(json, "_contentType"), res.getContentTypeElement());
19203    if (json.has("expression"))
19204      res.setExpressionElement(parseString(json.get("expression").getAsString()));
19205    if (json.has("_expression"))
19206      parseElementProperties(getJObject(json, "_expression"), res.getExpressionElement());
19207    if (json.has("headerField"))
19208      res.setHeaderFieldElement(parseString(json.get("headerField").getAsString()));
19209    if (json.has("_headerField"))
19210      parseElementProperties(getJObject(json, "_headerField"), res.getHeaderFieldElement());
19211    if (json.has("minimumId"))
19212      res.setMinimumIdElement(parseString(json.get("minimumId").getAsString()));
19213    if (json.has("_minimumId"))
19214      parseElementProperties(getJObject(json, "_minimumId"), res.getMinimumIdElement());
19215    if (json.has("navigationLinks"))
19216      res.setNavigationLinksElement(parseBoolean(json.get("navigationLinks").getAsBoolean()));
19217    if (json.has("_navigationLinks"))
19218      parseElementProperties(getJObject(json, "_navigationLinks"), res.getNavigationLinksElement());
19219    if (json.has("operator"))
19220      res.setOperatorElement(parseEnumeration(json.get("operator").getAsString(), TestScript.AssertionOperatorType.NULL, new TestScript.AssertionOperatorTypeEnumFactory()));
19221    if (json.has("_operator"))
19222      parseElementProperties(getJObject(json, "_operator"), res.getOperatorElement());
19223    if (json.has("path"))
19224      res.setPathElement(parseString(json.get("path").getAsString()));
19225    if (json.has("_path"))
19226      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
19227    if (json.has("requestMethod"))
19228      res.setRequestMethodElement(parseEnumeration(json.get("requestMethod").getAsString(), TestScript.TestScriptRequestMethodCode.NULL, new TestScript.TestScriptRequestMethodCodeEnumFactory()));
19229    if (json.has("_requestMethod"))
19230      parseElementProperties(getJObject(json, "_requestMethod"), res.getRequestMethodElement());
19231    if (json.has("requestURL"))
19232      res.setRequestURLElement(parseString(json.get("requestURL").getAsString()));
19233    if (json.has("_requestURL"))
19234      parseElementProperties(getJObject(json, "_requestURL"), res.getRequestURLElement());
19235    if (json.has("resource"))
19236      res.setResourceElement(parseCode(json.get("resource").getAsString()));
19237    if (json.has("_resource"))
19238      parseElementProperties(getJObject(json, "_resource"), res.getResourceElement());
19239    if (json.has("response"))
19240      res.setResponseElement(parseEnumeration(json.get("response").getAsString(), TestScript.AssertionResponseTypes.NULL, new TestScript.AssertionResponseTypesEnumFactory()));
19241    if (json.has("_response"))
19242      parseElementProperties(getJObject(json, "_response"), res.getResponseElement());
19243    if (json.has("responseCode"))
19244      res.setResponseCodeElement(parseString(json.get("responseCode").getAsString()));
19245    if (json.has("_responseCode"))
19246      parseElementProperties(getJObject(json, "_responseCode"), res.getResponseCodeElement());
19247    if (json.has("rule"))
19248      res.setRule(parseTestScriptActionAssertRuleComponent(getJObject(json, "rule"), owner));
19249    if (json.has("ruleset"))
19250      res.setRuleset(parseTestScriptActionAssertRulesetComponent(getJObject(json, "ruleset"), owner));
19251    if (json.has("sourceId"))
19252      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
19253    if (json.has("_sourceId"))
19254      parseElementProperties(getJObject(json, "_sourceId"), res.getSourceIdElement());
19255    if (json.has("validateProfileId"))
19256      res.setValidateProfileIdElement(parseId(json.get("validateProfileId").getAsString()));
19257    if (json.has("_validateProfileId"))
19258      parseElementProperties(getJObject(json, "_validateProfileId"), res.getValidateProfileIdElement());
19259    if (json.has("value"))
19260      res.setValueElement(parseString(json.get("value").getAsString()));
19261    if (json.has("_value"))
19262      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
19263    if (json.has("warningOnly"))
19264      res.setWarningOnlyElement(parseBoolean(json.get("warningOnly").getAsBoolean()));
19265    if (json.has("_warningOnly"))
19266      parseElementProperties(getJObject(json, "_warningOnly"), res.getWarningOnlyElement());
19267  }
19268
19269  protected TestScript.ActionAssertRuleComponent parseTestScriptActionAssertRuleComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
19270    TestScript.ActionAssertRuleComponent res = new TestScript.ActionAssertRuleComponent();
19271    parseTestScriptActionAssertRuleComponentProperties(json, owner, res);
19272    return res;
19273  }
19274
19275  protected void parseTestScriptActionAssertRuleComponentProperties(JsonObject json, TestScript owner, TestScript.ActionAssertRuleComponent res) throws IOException, FHIRFormatError {
19276    parseBackboneProperties(json, res);
19277    if (json.has("ruleId"))
19278      res.setRuleIdElement(parseId(json.get("ruleId").getAsString()));
19279    if (json.has("_ruleId"))
19280      parseElementProperties(getJObject(json, "_ruleId"), res.getRuleIdElement());
19281    if (json.has("param")) {
19282      JsonArray array = json.getAsJsonArray("param");
19283      for (int i = 0; i < array.size(); i++) {
19284        res.getParam().add(parseTestScriptActionAssertRuleParamComponent(array.get(i).getAsJsonObject(), owner));
19285      }
19286    };
19287  }
19288
19289  protected TestScript.ActionAssertRuleParamComponent parseTestScriptActionAssertRuleParamComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
19290    TestScript.ActionAssertRuleParamComponent res = new TestScript.ActionAssertRuleParamComponent();
19291    parseTestScriptActionAssertRuleParamComponentProperties(json, owner, res);
19292    return res;
19293  }
19294
19295  protected void parseTestScriptActionAssertRuleParamComponentProperties(JsonObject json, TestScript owner, TestScript.ActionAssertRuleParamComponent res) throws IOException, FHIRFormatError {
19296    parseBackboneProperties(json, res);
19297    if (json.has("name"))
19298      res.setNameElement(parseString(json.get("name").getAsString()));
19299    if (json.has("_name"))
19300      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
19301    if (json.has("value"))
19302      res.setValueElement(parseString(json.get("value").getAsString()));
19303    if (json.has("_value"))
19304      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
19305  }
19306
19307  protected TestScript.ActionAssertRulesetComponent parseTestScriptActionAssertRulesetComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
19308    TestScript.ActionAssertRulesetComponent res = new TestScript.ActionAssertRulesetComponent();
19309    parseTestScriptActionAssertRulesetComponentProperties(json, owner, res);
19310    return res;
19311  }
19312
19313  protected void parseTestScriptActionAssertRulesetComponentProperties(JsonObject json, TestScript owner, TestScript.ActionAssertRulesetComponent res) throws IOException, FHIRFormatError {
19314    parseBackboneProperties(json, res);
19315    if (json.has("rulesetId"))
19316      res.setRulesetIdElement(parseId(json.get("rulesetId").getAsString()));
19317    if (json.has("_rulesetId"))
19318      parseElementProperties(getJObject(json, "_rulesetId"), res.getRulesetIdElement());
19319    if (json.has("rule")) {
19320      JsonArray array = json.getAsJsonArray("rule");
19321      for (int i = 0; i < array.size(); i++) {
19322        res.getRule().add(parseTestScriptActionAssertRulesetRuleComponent(array.get(i).getAsJsonObject(), owner));
19323      }
19324    };
19325  }
19326
19327  protected TestScript.ActionAssertRulesetRuleComponent parseTestScriptActionAssertRulesetRuleComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
19328    TestScript.ActionAssertRulesetRuleComponent res = new TestScript.ActionAssertRulesetRuleComponent();
19329    parseTestScriptActionAssertRulesetRuleComponentProperties(json, owner, res);
19330    return res;
19331  }
19332
19333  protected void parseTestScriptActionAssertRulesetRuleComponentProperties(JsonObject json, TestScript owner, TestScript.ActionAssertRulesetRuleComponent res) throws IOException, FHIRFormatError {
19334    parseBackboneProperties(json, res);
19335    if (json.has("ruleId"))
19336      res.setRuleIdElement(parseId(json.get("ruleId").getAsString()));
19337    if (json.has("_ruleId"))
19338      parseElementProperties(getJObject(json, "_ruleId"), res.getRuleIdElement());
19339    if (json.has("param")) {
19340      JsonArray array = json.getAsJsonArray("param");
19341      for (int i = 0; i < array.size(); i++) {
19342        res.getParam().add(parseTestScriptActionAssertRulesetRuleParamComponent(array.get(i).getAsJsonObject(), owner));
19343      }
19344    };
19345  }
19346
19347  protected TestScript.ActionAssertRulesetRuleParamComponent parseTestScriptActionAssertRulesetRuleParamComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
19348    TestScript.ActionAssertRulesetRuleParamComponent res = new TestScript.ActionAssertRulesetRuleParamComponent();
19349    parseTestScriptActionAssertRulesetRuleParamComponentProperties(json, owner, res);
19350    return res;
19351  }
19352
19353  protected void parseTestScriptActionAssertRulesetRuleParamComponentProperties(JsonObject json, TestScript owner, TestScript.ActionAssertRulesetRuleParamComponent res) throws IOException, FHIRFormatError {
19354    parseBackboneProperties(json, res);
19355    if (json.has("name"))
19356      res.setNameElement(parseString(json.get("name").getAsString()));
19357    if (json.has("_name"))
19358      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
19359    if (json.has("value"))
19360      res.setValueElement(parseString(json.get("value").getAsString()));
19361    if (json.has("_value"))
19362      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
19363  }
19364
19365  protected TestScript.TestScriptTestComponent parseTestScriptTestScriptTestComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
19366    TestScript.TestScriptTestComponent res = new TestScript.TestScriptTestComponent();
19367    parseTestScriptTestScriptTestComponentProperties(json, owner, res);
19368    return res;
19369  }
19370
19371  protected void parseTestScriptTestScriptTestComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptTestComponent res) throws IOException, FHIRFormatError {
19372    parseBackboneProperties(json, res);
19373    if (json.has("name"))
19374      res.setNameElement(parseString(json.get("name").getAsString()));
19375    if (json.has("_name"))
19376      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
19377    if (json.has("description"))
19378      res.setDescriptionElement(parseString(json.get("description").getAsString()));
19379    if (json.has("_description"))
19380      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
19381    if (json.has("action")) {
19382      JsonArray array = json.getAsJsonArray("action");
19383      for (int i = 0; i < array.size(); i++) {
19384        res.getAction().add(parseTestScriptTestActionComponent(array.get(i).getAsJsonObject(), owner));
19385      }
19386    };
19387  }
19388
19389  protected TestScript.TestActionComponent parseTestScriptTestActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
19390    TestScript.TestActionComponent res = new TestScript.TestActionComponent();
19391    parseTestScriptTestActionComponentProperties(json, owner, res);
19392    return res;
19393  }
19394
19395  protected void parseTestScriptTestActionComponentProperties(JsonObject json, TestScript owner, TestScript.TestActionComponent res) throws IOException, FHIRFormatError {
19396    parseBackboneProperties(json, res);
19397    if (json.has("operation"))
19398      res.setOperation(parseTestScriptSetupActionOperationComponent(getJObject(json, "operation"), owner));
19399    if (json.has("assert"))
19400      res.setAssert(parseTestScriptSetupActionAssertComponent(getJObject(json, "assert"), owner));
19401  }
19402
19403  protected TestScript.TestScriptTeardownComponent parseTestScriptTestScriptTeardownComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
19404    TestScript.TestScriptTeardownComponent res = new TestScript.TestScriptTeardownComponent();
19405    parseTestScriptTestScriptTeardownComponentProperties(json, owner, res);
19406    return res;
19407  }
19408
19409  protected void parseTestScriptTestScriptTeardownComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptTeardownComponent res) throws IOException, FHIRFormatError {
19410    parseBackboneProperties(json, res);
19411    if (json.has("action")) {
19412      JsonArray array = json.getAsJsonArray("action");
19413      for (int i = 0; i < array.size(); i++) {
19414        res.getAction().add(parseTestScriptTeardownActionComponent(array.get(i).getAsJsonObject(), owner));
19415      }
19416    };
19417  }
19418
19419  protected TestScript.TeardownActionComponent parseTestScriptTeardownActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
19420    TestScript.TeardownActionComponent res = new TestScript.TeardownActionComponent();
19421    parseTestScriptTeardownActionComponentProperties(json, owner, res);
19422    return res;
19423  }
19424
19425  protected void parseTestScriptTeardownActionComponentProperties(JsonObject json, TestScript owner, TestScript.TeardownActionComponent res) throws IOException, FHIRFormatError {
19426    parseBackboneProperties(json, res);
19427    if (json.has("operation"))
19428      res.setOperation(parseTestScriptSetupActionOperationComponent(getJObject(json, "operation"), owner));
19429  }
19430
19431  protected ValueSet parseValueSet(JsonObject json) throws IOException, FHIRFormatError {
19432    ValueSet res = new ValueSet();
19433    parseValueSetProperties(json, res);
19434    return res;
19435  }
19436
19437  protected void parseValueSetProperties(JsonObject json, ValueSet res) throws IOException, FHIRFormatError {
19438    parseDomainResourceProperties(json, res);
19439    if (json.has("url"))
19440      res.setUrlElement(parseUri(json.get("url").getAsString()));
19441    if (json.has("_url"))
19442      parseElementProperties(getJObject(json, "_url"), res.getUrlElement());
19443    if (json.has("identifier")) {
19444      JsonArray array = json.getAsJsonArray("identifier");
19445      for (int i = 0; i < array.size(); i++) {
19446        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19447      }
19448    };
19449    if (json.has("version"))
19450      res.setVersionElement(parseString(json.get("version").getAsString()));
19451    if (json.has("_version"))
19452      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
19453    if (json.has("name"))
19454      res.setNameElement(parseString(json.get("name").getAsString()));
19455    if (json.has("_name"))
19456      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
19457    if (json.has("title"))
19458      res.setTitleElement(parseString(json.get("title").getAsString()));
19459    if (json.has("_title"))
19460      parseElementProperties(getJObject(json, "_title"), res.getTitleElement());
19461    if (json.has("status"))
19462      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
19463    if (json.has("_status"))
19464      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
19465    if (json.has("experimental"))
19466      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
19467    if (json.has("_experimental"))
19468      parseElementProperties(getJObject(json, "_experimental"), res.getExperimentalElement());
19469    if (json.has("date"))
19470      res.setDateElement(parseDateTime(json.get("date").getAsString()));
19471    if (json.has("_date"))
19472      parseElementProperties(getJObject(json, "_date"), res.getDateElement());
19473    if (json.has("publisher"))
19474      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
19475    if (json.has("_publisher"))
19476      parseElementProperties(getJObject(json, "_publisher"), res.getPublisherElement());
19477    if (json.has("contact")) {
19478      JsonArray array = json.getAsJsonArray("contact");
19479      for (int i = 0; i < array.size(); i++) {
19480        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
19481      }
19482    };
19483    if (json.has("description"))
19484      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
19485    if (json.has("_description"))
19486      parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement());
19487    if (json.has("useContext")) {
19488      JsonArray array = json.getAsJsonArray("useContext");
19489      for (int i = 0; i < array.size(); i++) {
19490        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
19491      }
19492    };
19493    if (json.has("jurisdiction")) {
19494      JsonArray array = json.getAsJsonArray("jurisdiction");
19495      for (int i = 0; i < array.size(); i++) {
19496        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19497      }
19498    };
19499    if (json.has("immutable"))
19500      res.setImmutableElement(parseBoolean(json.get("immutable").getAsBoolean()));
19501    if (json.has("_immutable"))
19502      parseElementProperties(getJObject(json, "_immutable"), res.getImmutableElement());
19503    if (json.has("purpose"))
19504      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
19505    if (json.has("_purpose"))
19506      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
19507    if (json.has("copyright"))
19508      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
19509    if (json.has("_copyright"))
19510      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
19511    if (json.has("extensible"))
19512      res.setExtensibleElement(parseBoolean(json.get("extensible").getAsBoolean()));
19513    if (json.has("_extensible"))
19514      parseElementProperties(getJObject(json, "_extensible"), res.getExtensibleElement());
19515    if (json.has("compose"))
19516      res.setCompose(parseValueSetValueSetComposeComponent(getJObject(json, "compose"), res));
19517    if (json.has("expansion"))
19518      res.setExpansion(parseValueSetValueSetExpansionComponent(getJObject(json, "expansion"), res));
19519  }
19520
19521  protected ValueSet.ValueSetComposeComponent parseValueSetValueSetComposeComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
19522    ValueSet.ValueSetComposeComponent res = new ValueSet.ValueSetComposeComponent();
19523    parseValueSetValueSetComposeComponentProperties(json, owner, res);
19524    return res;
19525  }
19526
19527  protected void parseValueSetValueSetComposeComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetComposeComponent res) throws IOException, FHIRFormatError {
19528    parseBackboneProperties(json, res);
19529    if (json.has("lockedDate"))
19530      res.setLockedDateElement(parseDate(json.get("lockedDate").getAsString()));
19531    if (json.has("_lockedDate"))
19532      parseElementProperties(getJObject(json, "_lockedDate"), res.getLockedDateElement());
19533    if (json.has("inactive"))
19534      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
19535    if (json.has("_inactive"))
19536      parseElementProperties(getJObject(json, "_inactive"), res.getInactiveElement());
19537    if (json.has("include")) {
19538      JsonArray array = json.getAsJsonArray("include");
19539      for (int i = 0; i < array.size(); i++) {
19540        res.getInclude().add(parseValueSetConceptSetComponent(array.get(i).getAsJsonObject(), owner));
19541      }
19542    };
19543    if (json.has("exclude")) {
19544      JsonArray array = json.getAsJsonArray("exclude");
19545      for (int i = 0; i < array.size(); i++) {
19546        res.getExclude().add(parseValueSetConceptSetComponent(array.get(i).getAsJsonObject(), owner));
19547      }
19548    };
19549  }
19550
19551  protected ValueSet.ConceptSetComponent parseValueSetConceptSetComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
19552    ValueSet.ConceptSetComponent res = new ValueSet.ConceptSetComponent();
19553    parseValueSetConceptSetComponentProperties(json, owner, res);
19554    return res;
19555  }
19556
19557  protected void parseValueSetConceptSetComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptSetComponent res) throws IOException, FHIRFormatError {
19558    parseBackboneProperties(json, res);
19559    if (json.has("system"))
19560      res.setSystemElement(parseUri(json.get("system").getAsString()));
19561    if (json.has("_system"))
19562      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
19563    if (json.has("version"))
19564      res.setVersionElement(parseString(json.get("version").getAsString()));
19565    if (json.has("_version"))
19566      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
19567    if (json.has("concept")) {
19568      JsonArray array = json.getAsJsonArray("concept");
19569      for (int i = 0; i < array.size(); i++) {
19570        res.getConcept().add(parseValueSetConceptReferenceComponent(array.get(i).getAsJsonObject(), owner));
19571      }
19572    };
19573    if (json.has("filter")) {
19574      JsonArray array = json.getAsJsonArray("filter");
19575      for (int i = 0; i < array.size(); i++) {
19576        res.getFilter().add(parseValueSetConceptSetFilterComponent(array.get(i).getAsJsonObject(), owner));
19577      }
19578    };
19579    if (json.has("valueSet")) {
19580      JsonArray array = json.getAsJsonArray("valueSet");
19581      for (int i = 0; i < array.size(); i++) {
19582        if (array.get(i).isJsonNull()) {
19583          res.getValueSet().add(new UriType());
19584        } else {
19585          res.getValueSet().add(parseUri(array.get(i).getAsString()));
19586        }
19587      }
19588    };
19589    if (json.has("_valueSet")) {
19590      JsonArray array = json.getAsJsonArray("_valueSet");
19591      for (int i = 0; i < array.size(); i++) {
19592        if (i == res.getValueSet().size())
19593          res.getValueSet().add(parseUri(null));
19594        if (array.get(i) instanceof JsonObject) 
19595          parseElementProperties(array.get(i).getAsJsonObject(), res.getValueSet().get(i));
19596      }
19597    };
19598  }
19599
19600  protected ValueSet.ConceptReferenceComponent parseValueSetConceptReferenceComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
19601    ValueSet.ConceptReferenceComponent res = new ValueSet.ConceptReferenceComponent();
19602    parseValueSetConceptReferenceComponentProperties(json, owner, res);
19603    return res;
19604  }
19605
19606  protected void parseValueSetConceptReferenceComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptReferenceComponent res) throws IOException, FHIRFormatError {
19607    parseBackboneProperties(json, res);
19608    if (json.has("code"))
19609      res.setCodeElement(parseCode(json.get("code").getAsString()));
19610    if (json.has("_code"))
19611      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
19612    if (json.has("display"))
19613      res.setDisplayElement(parseString(json.get("display").getAsString()));
19614    if (json.has("_display"))
19615      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
19616    if (json.has("designation")) {
19617      JsonArray array = json.getAsJsonArray("designation");
19618      for (int i = 0; i < array.size(); i++) {
19619        res.getDesignation().add(parseValueSetConceptReferenceDesignationComponent(array.get(i).getAsJsonObject(), owner));
19620      }
19621    };
19622  }
19623
19624  protected ValueSet.ConceptReferenceDesignationComponent parseValueSetConceptReferenceDesignationComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
19625    ValueSet.ConceptReferenceDesignationComponent res = new ValueSet.ConceptReferenceDesignationComponent();
19626    parseValueSetConceptReferenceDesignationComponentProperties(json, owner, res);
19627    return res;
19628  }
19629
19630  protected void parseValueSetConceptReferenceDesignationComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptReferenceDesignationComponent res) throws IOException, FHIRFormatError {
19631    parseBackboneProperties(json, res);
19632    if (json.has("language"))
19633      res.setLanguageElement(parseCode(json.get("language").getAsString()));
19634    if (json.has("_language"))
19635      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
19636    if (json.has("use"))
19637      res.setUse(parseCoding(getJObject(json, "use")));
19638    if (json.has("value"))
19639      res.setValueElement(parseString(json.get("value").getAsString()));
19640    if (json.has("_value"))
19641      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
19642  }
19643
19644  protected ValueSet.ConceptSetFilterComponent parseValueSetConceptSetFilterComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
19645    ValueSet.ConceptSetFilterComponent res = new ValueSet.ConceptSetFilterComponent();
19646    parseValueSetConceptSetFilterComponentProperties(json, owner, res);
19647    return res;
19648  }
19649
19650  protected void parseValueSetConceptSetFilterComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptSetFilterComponent res) throws IOException, FHIRFormatError {
19651    parseBackboneProperties(json, res);
19652    if (json.has("property"))
19653      res.setPropertyElement(parseCode(json.get("property").getAsString()));
19654    if (json.has("_property"))
19655      parseElementProperties(getJObject(json, "_property"), res.getPropertyElement());
19656    if (json.has("op"))
19657      res.setOpElement(parseEnumeration(json.get("op").getAsString(), ValueSet.FilterOperator.NULL, new ValueSet.FilterOperatorEnumFactory()));
19658    if (json.has("_op"))
19659      parseElementProperties(getJObject(json, "_op"), res.getOpElement());
19660    if (json.has("value"))
19661      res.setValueElement(parseCode(json.get("value").getAsString()));
19662    if (json.has("_value"))
19663      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
19664  }
19665
19666  protected ValueSet.ValueSetExpansionComponent parseValueSetValueSetExpansionComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
19667    ValueSet.ValueSetExpansionComponent res = new ValueSet.ValueSetExpansionComponent();
19668    parseValueSetValueSetExpansionComponentProperties(json, owner, res);
19669    return res;
19670  }
19671
19672  protected void parseValueSetValueSetExpansionComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetExpansionComponent res) throws IOException, FHIRFormatError {
19673    parseBackboneProperties(json, res);
19674    if (json.has("identifier"))
19675      res.setIdentifierElement(parseUri(json.get("identifier").getAsString()));
19676    if (json.has("_identifier"))
19677      parseElementProperties(getJObject(json, "_identifier"), res.getIdentifierElement());
19678    if (json.has("timestamp"))
19679      res.setTimestampElement(parseDateTime(json.get("timestamp").getAsString()));
19680    if (json.has("_timestamp"))
19681      parseElementProperties(getJObject(json, "_timestamp"), res.getTimestampElement());
19682    if (json.has("total"))
19683      res.setTotalElement(parseInteger(json.get("total").getAsLong()));
19684    if (json.has("_total"))
19685      parseElementProperties(getJObject(json, "_total"), res.getTotalElement());
19686    if (json.has("offset"))
19687      res.setOffsetElement(parseInteger(json.get("offset").getAsLong()));
19688    if (json.has("_offset"))
19689      parseElementProperties(getJObject(json, "_offset"), res.getOffsetElement());
19690    if (json.has("parameter")) {
19691      JsonArray array = json.getAsJsonArray("parameter");
19692      for (int i = 0; i < array.size(); i++) {
19693        res.getParameter().add(parseValueSetValueSetExpansionParameterComponent(array.get(i).getAsJsonObject(), owner));
19694      }
19695    };
19696    if (json.has("contains")) {
19697      JsonArray array = json.getAsJsonArray("contains");
19698      for (int i = 0; i < array.size(); i++) {
19699        res.getContains().add(parseValueSetValueSetExpansionContainsComponent(array.get(i).getAsJsonObject(), owner));
19700      }
19701    };
19702  }
19703
19704  protected ValueSet.ValueSetExpansionParameterComponent parseValueSetValueSetExpansionParameterComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
19705    ValueSet.ValueSetExpansionParameterComponent res = new ValueSet.ValueSetExpansionParameterComponent();
19706    parseValueSetValueSetExpansionParameterComponentProperties(json, owner, res);
19707    return res;
19708  }
19709
19710  protected void parseValueSetValueSetExpansionParameterComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetExpansionParameterComponent res) throws IOException, FHIRFormatError {
19711    parseBackboneProperties(json, res);
19712    if (json.has("name"))
19713      res.setNameElement(parseString(json.get("name").getAsString()));
19714    if (json.has("_name"))
19715      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
19716    Type value = parseType("value", json);
19717    if (value != null)
19718      res.setValue(value);
19719  }
19720
19721  protected ValueSet.ValueSetExpansionContainsComponent parseValueSetValueSetExpansionContainsComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
19722    ValueSet.ValueSetExpansionContainsComponent res = new ValueSet.ValueSetExpansionContainsComponent();
19723    parseValueSetValueSetExpansionContainsComponentProperties(json, owner, res);
19724    return res;
19725  }
19726
19727  protected void parseValueSetValueSetExpansionContainsComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetExpansionContainsComponent res) throws IOException, FHIRFormatError {
19728    parseBackboneProperties(json, res);
19729    if (json.has("system"))
19730      res.setSystemElement(parseUri(json.get("system").getAsString()));
19731    if (json.has("_system"))
19732      parseElementProperties(getJObject(json, "_system"), res.getSystemElement());
19733    if (json.has("abstract"))
19734      res.setAbstractElement(parseBoolean(json.get("abstract").getAsBoolean()));
19735    if (json.has("_abstract"))
19736      parseElementProperties(getJObject(json, "_abstract"), res.getAbstractElement());
19737    if (json.has("inactive"))
19738      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
19739    if (json.has("_inactive"))
19740      parseElementProperties(getJObject(json, "_inactive"), res.getInactiveElement());
19741    if (json.has("version"))
19742      res.setVersionElement(parseString(json.get("version").getAsString()));
19743    if (json.has("_version"))
19744      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
19745    if (json.has("code"))
19746      res.setCodeElement(parseCode(json.get("code").getAsString()));
19747    if (json.has("_code"))
19748      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
19749    if (json.has("display"))
19750      res.setDisplayElement(parseString(json.get("display").getAsString()));
19751    if (json.has("_display"))
19752      parseElementProperties(getJObject(json, "_display"), res.getDisplayElement());
19753    if (json.has("designation")) {
19754      JsonArray array = json.getAsJsonArray("designation");
19755      for (int i = 0; i < array.size(); i++) {
19756        res.getDesignation().add(parseValueSetConceptReferenceDesignationComponent(array.get(i).getAsJsonObject(), owner));
19757      }
19758    };
19759    if (json.has("contains")) {
19760      JsonArray array = json.getAsJsonArray("contains");
19761      for (int i = 0; i < array.size(); i++) {
19762        res.getContains().add(parseValueSetValueSetExpansionContainsComponent(array.get(i).getAsJsonObject(), owner));
19763      }
19764    };
19765  }
19766
19767  protected VisionPrescription parseVisionPrescription(JsonObject json) throws IOException, FHIRFormatError {
19768    VisionPrescription res = new VisionPrescription();
19769    parseVisionPrescriptionProperties(json, res);
19770    return res;
19771  }
19772
19773  protected void parseVisionPrescriptionProperties(JsonObject json, VisionPrescription res) throws IOException, FHIRFormatError {
19774    parseDomainResourceProperties(json, res);
19775    if (json.has("identifier")) {
19776      JsonArray array = json.getAsJsonArray("identifier");
19777      for (int i = 0; i < array.size(); i++) {
19778        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19779      }
19780    };
19781    if (json.has("status"))
19782      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), VisionPrescription.VisionStatus.NULL, new VisionPrescription.VisionStatusEnumFactory()));
19783    if (json.has("_status"))
19784      parseElementProperties(getJObject(json, "_status"), res.getStatusElement());
19785    if (json.has("patient"))
19786      res.setPatient(parseReference(getJObject(json, "patient")));
19787    if (json.has("encounter"))
19788      res.setEncounter(parseReference(getJObject(json, "encounter")));
19789    if (json.has("dateWritten"))
19790      res.setDateWrittenElement(parseDateTime(json.get("dateWritten").getAsString()));
19791    if (json.has("_dateWritten"))
19792      parseElementProperties(getJObject(json, "_dateWritten"), res.getDateWrittenElement());
19793    if (json.has("prescriber"))
19794      res.setPrescriber(parseReference(getJObject(json, "prescriber")));
19795    Type reason = parseType("reason", json);
19796    if (reason != null)
19797      res.setReason(reason);
19798    if (json.has("dispense")) {
19799      JsonArray array = json.getAsJsonArray("dispense");
19800      for (int i = 0; i < array.size(); i++) {
19801        res.getDispense().add(parseVisionPrescriptionVisionPrescriptionDispenseComponent(array.get(i).getAsJsonObject(), res));
19802      }
19803    };
19804  }
19805
19806  protected VisionPrescription.VisionPrescriptionDispenseComponent parseVisionPrescriptionVisionPrescriptionDispenseComponent(JsonObject json, VisionPrescription owner) throws IOException, FHIRFormatError {
19807    VisionPrescription.VisionPrescriptionDispenseComponent res = new VisionPrescription.VisionPrescriptionDispenseComponent();
19808    parseVisionPrescriptionVisionPrescriptionDispenseComponentProperties(json, owner, res);
19809    return res;
19810  }
19811
19812  protected void parseVisionPrescriptionVisionPrescriptionDispenseComponentProperties(JsonObject json, VisionPrescription owner, VisionPrescription.VisionPrescriptionDispenseComponent res) throws IOException, FHIRFormatError {
19813    parseBackboneProperties(json, res);
19814    if (json.has("product"))
19815      res.setProduct(parseCodeableConcept(getJObject(json, "product")));
19816    if (json.has("eye"))
19817      res.setEyeElement(parseEnumeration(json.get("eye").getAsString(), VisionPrescription.VisionEyes.NULL, new VisionPrescription.VisionEyesEnumFactory()));
19818    if (json.has("_eye"))
19819      parseElementProperties(getJObject(json, "_eye"), res.getEyeElement());
19820    if (json.has("sphere"))
19821      res.setSphereElement(parseDecimal(json.get("sphere").getAsBigDecimal()));
19822    if (json.has("_sphere"))
19823      parseElementProperties(getJObject(json, "_sphere"), res.getSphereElement());
19824    if (json.has("cylinder"))
19825      res.setCylinderElement(parseDecimal(json.get("cylinder").getAsBigDecimal()));
19826    if (json.has("_cylinder"))
19827      parseElementProperties(getJObject(json, "_cylinder"), res.getCylinderElement());
19828    if (json.has("axis"))
19829      res.setAxisElement(parseInteger(json.get("axis").getAsLong()));
19830    if (json.has("_axis"))
19831      parseElementProperties(getJObject(json, "_axis"), res.getAxisElement());
19832    if (json.has("prism"))
19833      res.setPrismElement(parseDecimal(json.get("prism").getAsBigDecimal()));
19834    if (json.has("_prism"))
19835      parseElementProperties(getJObject(json, "_prism"), res.getPrismElement());
19836    if (json.has("base"))
19837      res.setBaseElement(parseEnumeration(json.get("base").getAsString(), VisionPrescription.VisionBase.NULL, new VisionPrescription.VisionBaseEnumFactory()));
19838    if (json.has("_base"))
19839      parseElementProperties(getJObject(json, "_base"), res.getBaseElement());
19840    if (json.has("add"))
19841      res.setAddElement(parseDecimal(json.get("add").getAsBigDecimal()));
19842    if (json.has("_add"))
19843      parseElementProperties(getJObject(json, "_add"), res.getAddElement());
19844    if (json.has("power"))
19845      res.setPowerElement(parseDecimal(json.get("power").getAsBigDecimal()));
19846    if (json.has("_power"))
19847      parseElementProperties(getJObject(json, "_power"), res.getPowerElement());
19848    if (json.has("backCurve"))
19849      res.setBackCurveElement(parseDecimal(json.get("backCurve").getAsBigDecimal()));
19850    if (json.has("_backCurve"))
19851      parseElementProperties(getJObject(json, "_backCurve"), res.getBackCurveElement());
19852    if (json.has("diameter"))
19853      res.setDiameterElement(parseDecimal(json.get("diameter").getAsBigDecimal()));
19854    if (json.has("_diameter"))
19855      parseElementProperties(getJObject(json, "_diameter"), res.getDiameterElement());
19856    if (json.has("duration"))
19857      res.setDuration(parseSimpleQuantity(getJObject(json, "duration")));
19858    if (json.has("color"))
19859      res.setColorElement(parseString(json.get("color").getAsString()));
19860    if (json.has("_color"))
19861      parseElementProperties(getJObject(json, "_color"), res.getColorElement());
19862    if (json.has("brand"))
19863      res.setBrandElement(parseString(json.get("brand").getAsString()));
19864    if (json.has("_brand"))
19865      parseElementProperties(getJObject(json, "_brand"), res.getBrandElement());
19866    if (json.has("note")) {
19867      JsonArray array = json.getAsJsonArray("note");
19868      for (int i = 0; i < array.size(); i++) {
19869        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
19870      }
19871    };
19872  }
19873
19874  @Override
19875  protected Resource parseResource(JsonObject json) throws IOException, FHIRFormatError {
19876    if (!json.has("resourceType")) {
19877      throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
19878    }
19879    String t = json.get("resourceType").getAsString();
19880    if (Utilities.noString(t))
19881      throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
19882    if (t.equals("Parameters"))
19883      return parseParameters(json);
19884    else if (t.equals("Account"))
19885      return parseAccount(json);
19886    else if (t.equals("ActivityDefinition"))
19887      return parseActivityDefinition(json);
19888    else if (t.equals("AdverseEvent"))
19889      return parseAdverseEvent(json);
19890    else if (t.equals("AllergyIntolerance"))
19891      return parseAllergyIntolerance(json);
19892    else if (t.equals("Appointment"))
19893      return parseAppointment(json);
19894    else if (t.equals("AppointmentResponse"))
19895      return parseAppointmentResponse(json);
19896    else if (t.equals("AuditEvent"))
19897      return parseAuditEvent(json);
19898    else if (t.equals("Basic"))
19899      return parseBasic(json);
19900    else if (t.equals("Binary"))
19901      return parseBinary(json);
19902    else if (t.equals("BodySite"))
19903      return parseBodySite(json);
19904    else if (t.equals("Bundle"))
19905      return parseBundle(json);
19906    else if (t.equals("CapabilityStatement"))
19907      return parseCapabilityStatement(json);
19908    else if (t.equals("CarePlan"))
19909      return parseCarePlan(json);
19910    else if (t.equals("CareTeam"))
19911      return parseCareTeam(json);
19912    else if (t.equals("ChargeItem"))
19913      return parseChargeItem(json);
19914    else if (t.equals("Claim"))
19915      return parseClaim(json);
19916    else if (t.equals("ClaimResponse"))
19917      return parseClaimResponse(json);
19918    else if (t.equals("ClinicalImpression"))
19919      return parseClinicalImpression(json);
19920    else if (t.equals("CodeSystem"))
19921      return parseCodeSystem(json);
19922    else if (t.equals("Communication"))
19923      return parseCommunication(json);
19924    else if (t.equals("CommunicationRequest"))
19925      return parseCommunicationRequest(json);
19926    else if (t.equals("CompartmentDefinition"))
19927      return parseCompartmentDefinition(json);
19928    else if (t.equals("Composition"))
19929      return parseComposition(json);
19930    else if (t.equals("ConceptMap"))
19931      return parseConceptMap(json);
19932    else if (t.equals("Condition"))
19933      return parseCondition(json);
19934    else if (t.equals("Consent"))
19935      return parseConsent(json);
19936    else if (t.equals("Contract"))
19937      return parseContract(json);
19938    else if (t.equals("Coverage"))
19939      return parseCoverage(json);
19940    else if (t.equals("DataElement"))
19941      return parseDataElement(json);
19942    else if (t.equals("DetectedIssue"))
19943      return parseDetectedIssue(json);
19944    else if (t.equals("Device"))
19945      return parseDevice(json);
19946    else if (t.equals("DeviceComponent"))
19947      return parseDeviceComponent(json);
19948    else if (t.equals("DeviceMetric"))
19949      return parseDeviceMetric(json);
19950    else if (t.equals("DeviceRequest"))
19951      return parseDeviceRequest(json);
19952    else if (t.equals("DeviceUseStatement"))
19953      return parseDeviceUseStatement(json);
19954    else if (t.equals("DiagnosticReport"))
19955      return parseDiagnosticReport(json);
19956    else if (t.equals("DocumentManifest"))
19957      return parseDocumentManifest(json);
19958    else if (t.equals("DocumentReference"))
19959      return parseDocumentReference(json);
19960    else if (t.equals("EligibilityRequest"))
19961      return parseEligibilityRequest(json);
19962    else if (t.equals("EligibilityResponse"))
19963      return parseEligibilityResponse(json);
19964    else if (t.equals("Encounter"))
19965      return parseEncounter(json);
19966    else if (t.equals("Endpoint"))
19967      return parseEndpoint(json);
19968    else if (t.equals("EnrollmentRequest"))
19969      return parseEnrollmentRequest(json);
19970    else if (t.equals("EnrollmentResponse"))
19971      return parseEnrollmentResponse(json);
19972    else if (t.equals("EpisodeOfCare"))
19973      return parseEpisodeOfCare(json);
19974    else if (t.equals("ExpansionProfile"))
19975      return parseExpansionProfile(json);
19976    else if (t.equals("ExplanationOfBenefit"))
19977      return parseExplanationOfBenefit(json);
19978    else if (t.equals("FamilyMemberHistory"))
19979      return parseFamilyMemberHistory(json);
19980    else if (t.equals("Flag"))
19981      return parseFlag(json);
19982    else if (t.equals("Goal"))
19983      return parseGoal(json);
19984    else if (t.equals("GraphDefinition"))
19985      return parseGraphDefinition(json);
19986    else if (t.equals("Group"))
19987      return parseGroup(json);
19988    else if (t.equals("GuidanceResponse"))
19989      return parseGuidanceResponse(json);
19990    else if (t.equals("HealthcareService"))
19991      return parseHealthcareService(json);
19992    else if (t.equals("ImagingManifest"))
19993      return parseImagingManifest(json);
19994    else if (t.equals("ImagingStudy"))
19995      return parseImagingStudy(json);
19996    else if (t.equals("Immunization"))
19997      return parseImmunization(json);
19998    else if (t.equals("ImmunizationRecommendation"))
19999      return parseImmunizationRecommendation(json);
20000    else if (t.equals("ImplementationGuide"))
20001      return parseImplementationGuide(json);
20002    else if (t.equals("Library"))
20003      return parseLibrary(json);
20004    else if (t.equals("Linkage"))
20005      return parseLinkage(json);
20006    else if (t.equals("List"))
20007      return parseListResource(json);
20008    else if (t.equals("Location"))
20009      return parseLocation(json);
20010    else if (t.equals("Measure"))
20011      return parseMeasure(json);
20012    else if (t.equals("MeasureReport"))
20013      return parseMeasureReport(json);
20014    else if (t.equals("Media"))
20015      return parseMedia(json);
20016    else if (t.equals("Medication"))
20017      return parseMedication(json);
20018    else if (t.equals("MedicationAdministration"))
20019      return parseMedicationAdministration(json);
20020    else if (t.equals("MedicationDispense"))
20021      return parseMedicationDispense(json);
20022    else if (t.equals("MedicationRequest"))
20023      return parseMedicationRequest(json);
20024    else if (t.equals("MedicationStatement"))
20025      return parseMedicationStatement(json);
20026    else if (t.equals("MessageDefinition"))
20027      return parseMessageDefinition(json);
20028    else if (t.equals("MessageHeader"))
20029      return parseMessageHeader(json);
20030    else if (t.equals("NamingSystem"))
20031      return parseNamingSystem(json);
20032    else if (t.equals("NutritionOrder"))
20033      return parseNutritionOrder(json);
20034    else if (t.equals("Observation"))
20035      return parseObservation(json);
20036    else if (t.equals("OperationDefinition"))
20037      return parseOperationDefinition(json);
20038    else if (t.equals("OperationOutcome"))
20039      return parseOperationOutcome(json);
20040    else if (t.equals("Organization"))
20041      return parseOrganization(json);
20042    else if (t.equals("Patient"))
20043      return parsePatient(json);
20044    else if (t.equals("PaymentNotice"))
20045      return parsePaymentNotice(json);
20046    else if (t.equals("PaymentReconciliation"))
20047      return parsePaymentReconciliation(json);
20048    else if (t.equals("Person"))
20049      return parsePerson(json);
20050    else if (t.equals("PlanDefinition"))
20051      return parsePlanDefinition(json);
20052    else if (t.equals("Practitioner"))
20053      return parsePractitioner(json);
20054    else if (t.equals("PractitionerRole"))
20055      return parsePractitionerRole(json);
20056    else if (t.equals("Procedure"))
20057      return parseProcedure(json);
20058    else if (t.equals("ProcedureRequest"))
20059      return parseProcedureRequest(json);
20060    else if (t.equals("ProcessRequest"))
20061      return parseProcessRequest(json);
20062    else if (t.equals("ProcessResponse"))
20063      return parseProcessResponse(json);
20064    else if (t.equals("Provenance"))
20065      return parseProvenance(json);
20066    else if (t.equals("Questionnaire"))
20067      return parseQuestionnaire(json);
20068    else if (t.equals("QuestionnaireResponse"))
20069      return parseQuestionnaireResponse(json);
20070    else if (t.equals("ReferralRequest"))
20071      return parseReferralRequest(json);
20072    else if (t.equals("RelatedPerson"))
20073      return parseRelatedPerson(json);
20074    else if (t.equals("RequestGroup"))
20075      return parseRequestGroup(json);
20076    else if (t.equals("ResearchStudy"))
20077      return parseResearchStudy(json);
20078    else if (t.equals("ResearchSubject"))
20079      return parseResearchSubject(json);
20080    else if (t.equals("RiskAssessment"))
20081      return parseRiskAssessment(json);
20082    else if (t.equals("Schedule"))
20083      return parseSchedule(json);
20084    else if (t.equals("SearchParameter"))
20085      return parseSearchParameter(json);
20086    else if (t.equals("Sequence"))
20087      return parseSequence(json);
20088    else if (t.equals("ServiceDefinition"))
20089      return parseServiceDefinition(json);
20090    else if (t.equals("Slot"))
20091      return parseSlot(json);
20092    else if (t.equals("Specimen"))
20093      return parseSpecimen(json);
20094    else if (t.equals("StructureDefinition"))
20095      return parseStructureDefinition(json);
20096    else if (t.equals("StructureMap"))
20097      return parseStructureMap(json);
20098    else if (t.equals("Subscription"))
20099      return parseSubscription(json);
20100    else if (t.equals("Substance"))
20101      return parseSubstance(json);
20102    else if (t.equals("SupplyDelivery"))
20103      return parseSupplyDelivery(json);
20104    else if (t.equals("SupplyRequest"))
20105      return parseSupplyRequest(json);
20106    else if (t.equals("Task"))
20107      return parseTask(json);
20108    else if (t.equals("TestReport"))
20109      return parseTestReport(json);
20110    else if (t.equals("TestScript"))
20111      return parseTestScript(json);
20112    else if (t.equals("ValueSet"))
20113      return parseValueSet(json);
20114    else if (t.equals("VisionPrescription"))
20115      return parseVisionPrescription(json);
20116    else if (t.equals("Binary"))
20117      return parseBinary(json);
20118    throw new FHIRFormatError("Unknown.Unrecognised resource type '"+t+"' (in property 'resourceType')");
20119  }
20120
20121  protected Type parseType(String prefix, JsonObject json) throws IOException, FHIRFormatError {
20122    if (json.has(prefix+"Reference"))
20123      return parseReference(getJObject(json, prefix+"Reference"));
20124    else if (json.has(prefix+"Quantity"))
20125      return parseQuantity(getJObject(json, prefix+"Quantity"));
20126    else if (json.has(prefix+"Period"))
20127      return parsePeriod(getJObject(json, prefix+"Period"));
20128    else if (json.has(prefix+"Attachment"))
20129      return parseAttachment(getJObject(json, prefix+"Attachment"));
20130    else if (json.has(prefix+"Duration"))
20131      return parseDuration(getJObject(json, prefix+"Duration"));
20132    else if (json.has(prefix+"Count"))
20133      return parseCount(getJObject(json, prefix+"Count"));
20134    else if (json.has(prefix+"Range"))
20135      return parseRange(getJObject(json, prefix+"Range"));
20136    else if (json.has(prefix+"Annotation"))
20137      return parseAnnotation(getJObject(json, prefix+"Annotation"));
20138    else if (json.has(prefix+"Money"))
20139      return parseMoney(getJObject(json, prefix+"Money"));
20140    else if (json.has(prefix+"Identifier"))
20141      return parseIdentifier(getJObject(json, prefix+"Identifier"));
20142    else if (json.has(prefix+"Coding"))
20143      return parseCoding(getJObject(json, prefix+"Coding"));
20144    else if (json.has(prefix+"Signature"))
20145      return parseSignature(getJObject(json, prefix+"Signature"));
20146    else if (json.has(prefix+"SampledData"))
20147      return parseSampledData(getJObject(json, prefix+"SampledData"));
20148    else if (json.has(prefix+"Ratio"))
20149      return parseRatio(getJObject(json, prefix+"Ratio"));
20150    else if (json.has(prefix+"Distance"))
20151      return parseDistance(getJObject(json, prefix+"Distance"));
20152    else if (json.has(prefix+"Age"))
20153      return parseAge(getJObject(json, prefix+"Age"));
20154    else if (json.has(prefix+"CodeableConcept"))
20155      return parseCodeableConcept(getJObject(json, prefix+"CodeableConcept"));
20156    else if (json.has(prefix+"SimpleQuantity"))
20157      return parseSimpleQuantity(getJObject(json, prefix+"SimpleQuantity"));
20158    else if (json.has(prefix+"Meta"))
20159      return parseMeta(getJObject(json, prefix+"Meta"));
20160    else if (json.has(prefix+"Address"))
20161      return parseAddress(getJObject(json, prefix+"Address"));
20162    else if (json.has(prefix+"TriggerDefinition"))
20163      return parseTriggerDefinition(getJObject(json, prefix+"TriggerDefinition"));
20164    else if (json.has(prefix+"Contributor"))
20165      return parseContributor(getJObject(json, prefix+"Contributor"));
20166    else if (json.has(prefix+"DataRequirement"))
20167      return parseDataRequirement(getJObject(json, prefix+"DataRequirement"));
20168    else if (json.has(prefix+"Dosage"))
20169      return parseDosage(getJObject(json, prefix+"Dosage"));
20170    else if (json.has(prefix+"RelatedArtifact"))
20171      return parseRelatedArtifact(getJObject(json, prefix+"RelatedArtifact"));
20172    else if (json.has(prefix+"ContactDetail"))
20173      return parseContactDetail(getJObject(json, prefix+"ContactDetail"));
20174    else if (json.has(prefix+"HumanName"))
20175      return parseHumanName(getJObject(json, prefix+"HumanName"));
20176    else if (json.has(prefix+"ContactPoint"))
20177      return parseContactPoint(getJObject(json, prefix+"ContactPoint"));
20178    else if (json.has(prefix+"UsageContext"))
20179      return parseUsageContext(getJObject(json, prefix+"UsageContext"));
20180    else if (json.has(prefix+"Timing"))
20181      return parseTiming(getJObject(json, prefix+"Timing"));
20182    else if (json.has(prefix+"ElementDefinition"))
20183      return parseElementDefinition(getJObject(json, prefix+"ElementDefinition"));
20184    else if (json.has(prefix+"ParameterDefinition"))
20185      return parseParameterDefinition(getJObject(json, prefix+"ParameterDefinition"));
20186    else if (json.has(prefix+"Date") || json.has("_"+prefix+"Date")) {
20187      Type t = json.has(prefix+"Date") ? parseDate(json.get(prefix+"Date").getAsString()) : new DateType();
20188      if (json.has("_"+prefix+"Date"))
20189        parseElementProperties(getJObject(json, "_"+prefix+"Date"), t);
20190      return t;
20191    }
20192    else if (json.has(prefix+"DateTime") || json.has("_"+prefix+"DateTime")) {
20193      Type t = json.has(prefix+"DateTime") ? parseDateTime(json.get(prefix+"DateTime").getAsString()) : new DateTimeType();
20194      if (json.has("_"+prefix+"DateTime"))
20195        parseElementProperties(getJObject(json, "_"+prefix+"DateTime"), t);
20196      return t;
20197    }
20198    else if (json.has(prefix+"Code") || json.has("_"+prefix+"Code")) {
20199      Type t = json.has(prefix+"Code") ? parseCode(json.get(prefix+"Code").getAsString()) : new CodeType();
20200      if (json.has("_"+prefix+"Code"))
20201        parseElementProperties(getJObject(json, "_"+prefix+"Code"), t);
20202      return t;
20203    }
20204    else if (json.has(prefix+"String") || json.has("_"+prefix+"String")) {
20205      Type t = json.has(prefix+"String") ? parseString(json.get(prefix+"String").getAsString()) : new StringType();
20206      if (json.has("_"+prefix+"String"))
20207        parseElementProperties(getJObject(json, "_"+prefix+"String"), t);
20208      return t;
20209    }
20210    else if (json.has(prefix+"Integer") || json.has("_"+prefix+"Integer")) {
20211      Type t = json.has(prefix+"Integer") ? parseInteger(json.get(prefix+"Integer").getAsLong()) : new IntegerType();
20212      if (json.has("_"+prefix+"Integer"))
20213        parseElementProperties(getJObject(json, "_"+prefix+"Integer"), t);
20214      return t;
20215    }
20216    else if (json.has(prefix+"Oid") || json.has("_"+prefix+"Oid")) {
20217      Type t = json.has(prefix+"Oid") ? parseOid(json.get(prefix+"Oid").getAsString()) : new OidType();
20218      if (json.has("_"+prefix+"Oid"))
20219        parseElementProperties(getJObject(json, "_"+prefix+"Oid"), t);
20220      return t;
20221    }
20222    else if (json.has(prefix+"Uri") || json.has("_"+prefix+"Uri")) {
20223      Type t = json.has(prefix+"Uri") ? parseUri(json.get(prefix+"Uri").getAsString()) : new UriType();
20224      if (json.has("_"+prefix+"Uri"))
20225        parseElementProperties(getJObject(json, "_"+prefix+"Uri"), t);
20226      return t;
20227    }
20228    else if (json.has(prefix+"Uuid") || json.has("_"+prefix+"Uuid")) {
20229      Type t = json.has(prefix+"Uuid") ? parseUuid(json.get(prefix+"Uuid").getAsString()) : new UuidType();
20230      if (json.has("_"+prefix+"Uuid"))
20231        parseElementProperties(getJObject(json, "_"+prefix+"Uuid"), t);
20232      return t;
20233    }
20234    else if (json.has(prefix+"Instant") || json.has("_"+prefix+"Instant")) {
20235      Type t = json.has(prefix+"Instant") ? parseInstant(json.get(prefix+"Instant").getAsString()) : new InstantType();
20236      if (json.has("_"+prefix+"Instant"))
20237        parseElementProperties(getJObject(json, "_"+prefix+"Instant"), t);
20238      return t;
20239    }
20240    else if (json.has(prefix+"Boolean") || json.has("_"+prefix+"Boolean")) {
20241      Type t = json.has(prefix+"Boolean") ? parseBoolean(json.get(prefix+"Boolean").getAsBoolean()) : new BooleanType();
20242      if (json.has("_"+prefix+"Boolean"))
20243        parseElementProperties(getJObject(json, "_"+prefix+"Boolean"), t);
20244      return t;
20245    }
20246    else if (json.has(prefix+"Base64Binary") || json.has("_"+prefix+"Base64Binary")) {
20247      Type t = json.has(prefix+"Base64Binary") ? parseBase64Binary(json.get(prefix+"Base64Binary").getAsString()) : new Base64BinaryType();
20248      if (json.has("_"+prefix+"Base64Binary"))
20249        parseElementProperties(getJObject(json, "_"+prefix+"Base64Binary"), t);
20250      return t;
20251    }
20252    else if (json.has(prefix+"UnsignedInt") || json.has("_"+prefix+"UnsignedInt")) {
20253      Type t = json.has(prefix+"UnsignedInt") ? parseUnsignedInt(json.get(prefix+"UnsignedInt").getAsString()) : new UnsignedIntType();
20254      if (json.has("_"+prefix+"UnsignedInt"))
20255        parseElementProperties(getJObject(json, "_"+prefix+"UnsignedInt"), t);
20256      return t;
20257    }
20258    else if (json.has(prefix+"Markdown") || json.has("_"+prefix+"Markdown")) {
20259      Type t = json.has(prefix+"Markdown") ? parseMarkdown(json.get(prefix+"Markdown").getAsString()) : new MarkdownType();
20260      if (json.has("_"+prefix+"Markdown"))
20261        parseElementProperties(getJObject(json, "_"+prefix+"Markdown"), t);
20262      return t;
20263    }
20264    else if (json.has(prefix+"Time") || json.has("_"+prefix+"Time")) {
20265      Type t = json.has(prefix+"Time") ? parseTime(json.get(prefix+"Time").getAsString()) : new TimeType();
20266      if (json.has("_"+prefix+"Time"))
20267        parseElementProperties(getJObject(json, "_"+prefix+"Time"), t);
20268      return t;
20269    }
20270    else if (json.has(prefix+"Id") || json.has("_"+prefix+"Id")) {
20271      Type t = json.has(prefix+"Id") ? parseId(json.get(prefix+"Id").getAsString()) : new IdType();
20272      if (json.has("_"+prefix+"Id"))
20273        parseElementProperties(getJObject(json, "_"+prefix+"Id"), t);
20274      return t;
20275    }
20276    else if (json.has(prefix+"PositiveInt") || json.has("_"+prefix+"PositiveInt")) {
20277      Type t = json.has(prefix+"PositiveInt") ? parsePositiveInt(json.get(prefix+"PositiveInt").getAsString()) : new PositiveIntType();
20278      if (json.has("_"+prefix+"PositiveInt"))
20279        parseElementProperties(getJObject(json, "_"+prefix+"PositiveInt"), t);
20280      return t;
20281    }
20282    else if (json.has(prefix+"Decimal") || json.has("_"+prefix+"Decimal")) {
20283      Type t = json.has(prefix+"Decimal") ? parseDecimal(json.get(prefix+"Decimal").getAsBigDecimal()) : new DecimalType();
20284      if (json.has("_"+prefix+"Decimal"))
20285        parseElementProperties(getJObject(json, "_"+prefix+"Decimal"), t);
20286      return t;
20287    }
20288    return null;
20289  }
20290
20291  protected Type parseType(JsonObject json, String type) throws IOException, FHIRFormatError {
20292    if (type.equals("Reference"))
20293      return parseReference(json);
20294    else if (type.equals("Quantity"))
20295      return parseQuantity(json);
20296    else if (type.equals("Period"))
20297      return parsePeriod(json);
20298    else if (type.equals("Attachment"))
20299      return parseAttachment(json);
20300    else if (type.equals("Duration"))
20301      return parseDuration(json);
20302    else if (type.equals("Count"))
20303      return parseCount(json);
20304    else if (type.equals("Range"))
20305      return parseRange(json);
20306    else if (type.equals("Annotation"))
20307      return parseAnnotation(json);
20308    else if (type.equals("Money"))
20309      return parseMoney(json);
20310    else if (type.equals("Identifier"))
20311      return parseIdentifier(json);
20312    else if (type.equals("Coding"))
20313      return parseCoding(json);
20314    else if (type.equals("Signature"))
20315      return parseSignature(json);
20316    else if (type.equals("SampledData"))
20317      return parseSampledData(json);
20318    else if (type.equals("Ratio"))
20319      return parseRatio(json);
20320    else if (type.equals("Distance"))
20321      return parseDistance(json);
20322    else if (type.equals("Age"))
20323      return parseAge(json);
20324    else if (type.equals("CodeableConcept"))
20325      return parseCodeableConcept(json);
20326    else if (type.equals("SimpleQuantity"))
20327      return parseSimpleQuantity(json);
20328    else if (type.equals("Meta"))
20329      return parseMeta(json);
20330    else if (type.equals("Address"))
20331      return parseAddress(json);
20332    else if (type.equals("TriggerDefinition"))
20333      return parseTriggerDefinition(json);
20334    else if (type.equals("Contributor"))
20335      return parseContributor(json);
20336    else if (type.equals("DataRequirement"))
20337      return parseDataRequirement(json);
20338    else if (type.equals("Dosage"))
20339      return parseDosage(json);
20340    else if (type.equals("RelatedArtifact"))
20341      return parseRelatedArtifact(json);
20342    else if (type.equals("ContactDetail"))
20343      return parseContactDetail(json);
20344    else if (type.equals("HumanName"))
20345      return parseHumanName(json);
20346    else if (type.equals("ContactPoint"))
20347      return parseContactPoint(json);
20348    else if (type.equals("UsageContext"))
20349      return parseUsageContext(json);
20350    else if (type.equals("Timing"))
20351      return parseTiming(json);
20352    else if (type.equals("ElementDefinition"))
20353      return parseElementDefinition(json);
20354    else if (type.equals("ParameterDefinition"))
20355      return parseParameterDefinition(json);
20356    throw new FHIRFormatError("Unknown Type "+type);
20357  }
20358
20359  protected boolean hasTypeName(JsonObject json, String prefix) {
20360        if (json.has(prefix+"Reference"))
20361      return true;
20362    if (json.has(prefix+"Quantity"))
20363      return true;
20364    if (json.has(prefix+"Period"))
20365      return true;
20366    if (json.has(prefix+"Attachment"))
20367      return true;
20368    if (json.has(prefix+"Duration"))
20369      return true;
20370    if (json.has(prefix+"Count"))
20371      return true;
20372    if (json.has(prefix+"Range"))
20373      return true;
20374    if (json.has(prefix+"Annotation"))
20375      return true;
20376    if (json.has(prefix+"Money"))
20377      return true;
20378    if (json.has(prefix+"Identifier"))
20379      return true;
20380    if (json.has(prefix+"Coding"))
20381      return true;
20382    if (json.has(prefix+"Signature"))
20383      return true;
20384    if (json.has(prefix+"SampledData"))
20385      return true;
20386    if (json.has(prefix+"Ratio"))
20387      return true;
20388    if (json.has(prefix+"Distance"))
20389      return true;
20390    if (json.has(prefix+"Age"))
20391      return true;
20392    if (json.has(prefix+"CodeableConcept"))
20393      return true;
20394    if (json.has(prefix+"SimpleQuantity"))
20395      return true;
20396    if (json.has(prefix+"Meta"))
20397      return true;
20398    if (json.has(prefix+"Address"))
20399      return true;
20400    if (json.has(prefix+"TriggerDefinition"))
20401      return true;
20402    if (json.has(prefix+"Contributor"))
20403      return true;
20404    if (json.has(prefix+"DataRequirement"))
20405      return true;
20406    if (json.has(prefix+"Dosage"))
20407      return true;
20408    if (json.has(prefix+"RelatedArtifact"))
20409      return true;
20410    if (json.has(prefix+"ContactDetail"))
20411      return true;
20412    if (json.has(prefix+"HumanName"))
20413      return true;
20414    if (json.has(prefix+"ContactPoint"))
20415      return true;
20416    if (json.has(prefix+"UsageContext"))
20417      return true;
20418    if (json.has(prefix+"Timing"))
20419      return true;
20420    if (json.has(prefix+"ElementDefinition"))
20421      return true;
20422    if (json.has(prefix+"ParameterDefinition"))
20423      return true;
20424    if (json.has(prefix+"Parameters"))
20425      return true;
20426    if (json.has(prefix+"Account"))
20427      return true;
20428    if (json.has(prefix+"ActivityDefinition"))
20429      return true;
20430    if (json.has(prefix+"AdverseEvent"))
20431      return true;
20432    if (json.has(prefix+"AllergyIntolerance"))
20433      return true;
20434    if (json.has(prefix+"Appointment"))
20435      return true;
20436    if (json.has(prefix+"AppointmentResponse"))
20437      return true;
20438    if (json.has(prefix+"AuditEvent"))
20439      return true;
20440    if (json.has(prefix+"Basic"))
20441      return true;
20442    if (json.has(prefix+"Binary"))
20443      return true;
20444    if (json.has(prefix+"BodySite"))
20445      return true;
20446    if (json.has(prefix+"Bundle"))
20447      return true;
20448    if (json.has(prefix+"CapabilityStatement"))
20449      return true;
20450    if (json.has(prefix+"CarePlan"))
20451      return true;
20452    if (json.has(prefix+"CareTeam"))
20453      return true;
20454    if (json.has(prefix+"ChargeItem"))
20455      return true;
20456    if (json.has(prefix+"Claim"))
20457      return true;
20458    if (json.has(prefix+"ClaimResponse"))
20459      return true;
20460    if (json.has(prefix+"ClinicalImpression"))
20461      return true;
20462    if (json.has(prefix+"CodeSystem"))
20463      return true;
20464    if (json.has(prefix+"Communication"))
20465      return true;
20466    if (json.has(prefix+"CommunicationRequest"))
20467      return true;
20468    if (json.has(prefix+"CompartmentDefinition"))
20469      return true;
20470    if (json.has(prefix+"Composition"))
20471      return true;
20472    if (json.has(prefix+"ConceptMap"))
20473      return true;
20474    if (json.has(prefix+"Condition"))
20475      return true;
20476    if (json.has(prefix+"Consent"))
20477      return true;
20478    if (json.has(prefix+"Contract"))
20479      return true;
20480    if (json.has(prefix+"Coverage"))
20481      return true;
20482    if (json.has(prefix+"DataElement"))
20483      return true;
20484    if (json.has(prefix+"DetectedIssue"))
20485      return true;
20486    if (json.has(prefix+"Device"))
20487      return true;
20488    if (json.has(prefix+"DeviceComponent"))
20489      return true;
20490    if (json.has(prefix+"DeviceMetric"))
20491      return true;
20492    if (json.has(prefix+"DeviceRequest"))
20493      return true;
20494    if (json.has(prefix+"DeviceUseStatement"))
20495      return true;
20496    if (json.has(prefix+"DiagnosticReport"))
20497      return true;
20498    if (json.has(prefix+"DocumentManifest"))
20499      return true;
20500    if (json.has(prefix+"DocumentReference"))
20501      return true;
20502    if (json.has(prefix+"EligibilityRequest"))
20503      return true;
20504    if (json.has(prefix+"EligibilityResponse"))
20505      return true;
20506    if (json.has(prefix+"Encounter"))
20507      return true;
20508    if (json.has(prefix+"Endpoint"))
20509      return true;
20510    if (json.has(prefix+"EnrollmentRequest"))
20511      return true;
20512    if (json.has(prefix+"EnrollmentResponse"))
20513      return true;
20514    if (json.has(prefix+"EpisodeOfCare"))
20515      return true;
20516    if (json.has(prefix+"ExpansionProfile"))
20517      return true;
20518    if (json.has(prefix+"ExplanationOfBenefit"))
20519      return true;
20520    if (json.has(prefix+"FamilyMemberHistory"))
20521      return true;
20522    if (json.has(prefix+"Flag"))
20523      return true;
20524    if (json.has(prefix+"Goal"))
20525      return true;
20526    if (json.has(prefix+"GraphDefinition"))
20527      return true;
20528    if (json.has(prefix+"Group"))
20529      return true;
20530    if (json.has(prefix+"GuidanceResponse"))
20531      return true;
20532    if (json.has(prefix+"HealthcareService"))
20533      return true;
20534    if (json.has(prefix+"ImagingManifest"))
20535      return true;
20536    if (json.has(prefix+"ImagingStudy"))
20537      return true;
20538    if (json.has(prefix+"Immunization"))
20539      return true;
20540    if (json.has(prefix+"ImmunizationRecommendation"))
20541      return true;
20542    if (json.has(prefix+"ImplementationGuide"))
20543      return true;
20544    if (json.has(prefix+"Library"))
20545      return true;
20546    if (json.has(prefix+"Linkage"))
20547      return true;
20548    if (json.has(prefix+"List"))
20549      return true;
20550    if (json.has(prefix+"Location"))
20551      return true;
20552    if (json.has(prefix+"Measure"))
20553      return true;
20554    if (json.has(prefix+"MeasureReport"))
20555      return true;
20556    if (json.has(prefix+"Media"))
20557      return true;
20558    if (json.has(prefix+"Medication"))
20559      return true;
20560    if (json.has(prefix+"MedicationAdministration"))
20561      return true;
20562    if (json.has(prefix+"MedicationDispense"))
20563      return true;
20564    if (json.has(prefix+"MedicationRequest"))
20565      return true;
20566    if (json.has(prefix+"MedicationStatement"))
20567      return true;
20568    if (json.has(prefix+"MessageDefinition"))
20569      return true;
20570    if (json.has(prefix+"MessageHeader"))
20571      return true;
20572    if (json.has(prefix+"NamingSystem"))
20573      return true;
20574    if (json.has(prefix+"NutritionOrder"))
20575      return true;
20576    if (json.has(prefix+"Observation"))
20577      return true;
20578    if (json.has(prefix+"OperationDefinition"))
20579      return true;
20580    if (json.has(prefix+"OperationOutcome"))
20581      return true;
20582    if (json.has(prefix+"Organization"))
20583      return true;
20584    if (json.has(prefix+"Patient"))
20585      return true;
20586    if (json.has(prefix+"PaymentNotice"))
20587      return true;
20588    if (json.has(prefix+"PaymentReconciliation"))
20589      return true;
20590    if (json.has(prefix+"Person"))
20591      return true;
20592    if (json.has(prefix+"PlanDefinition"))
20593      return true;
20594    if (json.has(prefix+"Practitioner"))
20595      return true;
20596    if (json.has(prefix+"PractitionerRole"))
20597      return true;
20598    if (json.has(prefix+"Procedure"))
20599      return true;
20600    if (json.has(prefix+"ProcedureRequest"))
20601      return true;
20602    if (json.has(prefix+"ProcessRequest"))
20603      return true;
20604    if (json.has(prefix+"ProcessResponse"))
20605      return true;
20606    if (json.has(prefix+"Provenance"))
20607      return true;
20608    if (json.has(prefix+"Questionnaire"))
20609      return true;
20610    if (json.has(prefix+"QuestionnaireResponse"))
20611      return true;
20612    if (json.has(prefix+"ReferralRequest"))
20613      return true;
20614    if (json.has(prefix+"RelatedPerson"))
20615      return true;
20616    if (json.has(prefix+"RequestGroup"))
20617      return true;
20618    if (json.has(prefix+"ResearchStudy"))
20619      return true;
20620    if (json.has(prefix+"ResearchSubject"))
20621      return true;
20622    if (json.has(prefix+"RiskAssessment"))
20623      return true;
20624    if (json.has(prefix+"Schedule"))
20625      return true;
20626    if (json.has(prefix+"SearchParameter"))
20627      return true;
20628    if (json.has(prefix+"Sequence"))
20629      return true;
20630    if (json.has(prefix+"ServiceDefinition"))
20631      return true;
20632    if (json.has(prefix+"Slot"))
20633      return true;
20634    if (json.has(prefix+"Specimen"))
20635      return true;
20636    if (json.has(prefix+"StructureDefinition"))
20637      return true;
20638    if (json.has(prefix+"StructureMap"))
20639      return true;
20640    if (json.has(prefix+"Subscription"))
20641      return true;
20642    if (json.has(prefix+"Substance"))
20643      return true;
20644    if (json.has(prefix+"SupplyDelivery"))
20645      return true;
20646    if (json.has(prefix+"SupplyRequest"))
20647      return true;
20648    if (json.has(prefix+"Task"))
20649      return true;
20650    if (json.has(prefix+"TestReport"))
20651      return true;
20652    if (json.has(prefix+"TestScript"))
20653      return true;
20654    if (json.has(prefix+"ValueSet"))
20655      return true;
20656    if (json.has(prefix+"VisionPrescription"))
20657      return true;
20658    if (json.has(prefix+"Date") || json.has("_"+prefix+"Date"))
20659      return true;
20660    if (json.has(prefix+"DateTime") || json.has("_"+prefix+"DateTime"))
20661      return true;
20662    if (json.has(prefix+"Code") || json.has("_"+prefix+"Code"))
20663      return true;
20664    if (json.has(prefix+"String") || json.has("_"+prefix+"String"))
20665      return true;
20666    if (json.has(prefix+"Integer") || json.has("_"+prefix+"Integer"))
20667      return true;
20668    if (json.has(prefix+"Oid") || json.has("_"+prefix+"Oid"))
20669      return true;
20670    if (json.has(prefix+"Uri") || json.has("_"+prefix+"Uri"))
20671      return true;
20672    if (json.has(prefix+"Uuid") || json.has("_"+prefix+"Uuid"))
20673      return true;
20674    if (json.has(prefix+"Instant") || json.has("_"+prefix+"Instant"))
20675      return true;
20676    if (json.has(prefix+"Boolean") || json.has("_"+prefix+"Boolean"))
20677      return true;
20678    if (json.has(prefix+"Base64Binary") || json.has("_"+prefix+"Base64Binary"))
20679      return true;
20680    if (json.has(prefix+"UnsignedInt") || json.has("_"+prefix+"UnsignedInt"))
20681      return true;
20682    if (json.has(prefix+"Markdown") || json.has("_"+prefix+"Markdown"))
20683      return true;
20684    if (json.has(prefix+"Time") || json.has("_"+prefix+"Time"))
20685      return true;
20686    if (json.has(prefix+"Id") || json.has("_"+prefix+"Id"))
20687      return true;
20688    if (json.has(prefix+"PositiveInt") || json.has("_"+prefix+"PositiveInt"))
20689      return true;
20690    if (json.has(prefix+"Decimal") || json.has("_"+prefix+"Decimal"))
20691      return true;
20692    return false;
20693  }
20694  protected void composeElement(Element element) throws IOException {
20695    if (element.hasId())
20696      prop("id", element.getId());
20697      if (makeComments(element)) {
20698        openArray("fhir_comments");
20699        for (String s : element.getFormatCommentsPre())
20700          prop(null,  s);
20701        for (String s : element.getFormatCommentsPost())
20702          prop(null,  s);
20703         closeArray();
20704      }
20705    if (element.hasExtension()) {
20706      openArray("extension");
20707      for (Extension e : element.getExtension())
20708        composeExtension(null, e);
20709      closeArray();
20710    }
20711  }
20712
20713  protected void composeBackbone(BackboneElement element) throws IOException {
20714    composeElement(element);
20715    if (element.hasModifierExtension()) {
20716      openArray("modifierExtension");
20717      for (Extension e : element.getModifierExtension())
20718        composeExtension(null, e);
20719      closeArray();
20720    }
20721  }
20722
20723  protected <E extends Enum<E>> void composeEnumerationCore(String name, Enumeration<E> value, EnumFactory e, boolean inArray) throws IOException {
20724    if (value != null && value.getValue() != null) {
20725      prop(name, e.toCode(value.getValue()));
20726    } else if (inArray)   
20727      writeNull(name);
20728  }    
20729
20730  protected <E extends Enum<E>> void composeEnumerationExtras(String name, Enumeration<E> value, EnumFactory e, boolean inArray) throws IOException {
20731    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20732      open(inArray ? null : "_"+name);
20733      composeElement(value);
20734      close();
20735    } else if (inArray)   
20736      writeNull(name);
20737  }    
20738
20739  protected void composeDateCore(String name, DateType value, boolean inArray) throws IOException {
20740    if (value != null && value.hasValue()) {
20741        prop(name, value.asStringValue());
20742    }    
20743    else if (inArray) 
20744      writeNull(name); 
20745  }    
20746
20747  protected void composeDateExtras(String name, DateType value, boolean inArray) throws IOException {
20748    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20749      open(inArray ? null : "_"+name);
20750      composeElement(value);
20751      close();
20752    }
20753    else if (inArray) 
20754      writeNull(name); 
20755  }
20756
20757  protected void composeDateTimeCore(String name, DateTimeType value, boolean inArray) throws IOException {
20758    if (value != null && value.hasValue()) {
20759        prop(name, value.asStringValue());
20760    }    
20761    else if (inArray) 
20762      writeNull(name); 
20763  }    
20764
20765  protected void composeDateTimeExtras(String name, DateTimeType value, boolean inArray) throws IOException {
20766    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20767      open(inArray ? null : "_"+name);
20768      composeElement(value);
20769      close();
20770    }
20771    else if (inArray) 
20772      writeNull(name); 
20773  }
20774
20775  protected void composeCodeCore(String name, CodeType value, boolean inArray) throws IOException {
20776    if (value != null && value.hasValue()) {
20777        prop(name, toString(value.getValue()));
20778    }    
20779    else if (inArray) 
20780      writeNull(name); 
20781  }    
20782
20783  protected void composeCodeExtras(String name, CodeType value, boolean inArray) throws IOException {
20784    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20785      open(inArray ? null : "_"+name);
20786      composeElement(value);
20787      close();
20788    }
20789    else if (inArray) 
20790      writeNull(name); 
20791  }
20792
20793  protected void composeStringCore(String name, StringType value, boolean inArray) throws IOException {
20794    if (value != null && value.hasValue()) {
20795        prop(name, toString(value.getValue()));
20796    }    
20797    else if (inArray) 
20798      writeNull(name); 
20799  }    
20800
20801  protected void composeStringExtras(String name, StringType value, boolean inArray) throws IOException {
20802    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20803      open(inArray ? null : "_"+name);
20804      composeElement(value);
20805      close();
20806    }
20807    else if (inArray) 
20808      writeNull(name); 
20809  }
20810
20811  protected void composeIntegerCore(String name, IntegerType value, boolean inArray) throws IOException {
20812    if (value != null && value.hasValue()) {
20813        prop(name, Integer.valueOf(value.getValue()));
20814    }    
20815    else if (inArray) 
20816      writeNull(name); 
20817  }    
20818
20819  protected void composeIntegerExtras(String name, IntegerType value, boolean inArray) throws IOException {
20820    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20821      open(inArray ? null : "_"+name);
20822      composeElement(value);
20823      close();
20824    }
20825    else if (inArray) 
20826      writeNull(name); 
20827  }
20828
20829  protected void composeOidCore(String name, OidType value, boolean inArray) throws IOException {
20830    if (value != null && value.hasValue()) {
20831        prop(name, toString(value.getValue()));
20832    }    
20833    else if (inArray) 
20834      writeNull(name); 
20835  }    
20836
20837  protected void composeOidExtras(String name, OidType value, boolean inArray) throws IOException {
20838    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20839      open(inArray ? null : "_"+name);
20840      composeElement(value);
20841      close();
20842    }
20843    else if (inArray) 
20844      writeNull(name); 
20845  }
20846
20847  protected void composeUriCore(String name, UriType value, boolean inArray) throws IOException {
20848    if (value != null && value.hasValue()) {
20849        prop(name, toString(value.getValue()));
20850    }    
20851    else if (inArray) 
20852      writeNull(name); 
20853  }    
20854
20855  protected void composeUriExtras(String name, UriType value, boolean inArray) throws IOException {
20856    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20857      open(inArray ? null : "_"+name);
20858      composeElement(value);
20859      close();
20860    }
20861    else if (inArray) 
20862      writeNull(name); 
20863  }
20864
20865  protected void composeUuidCore(String name, UuidType value, boolean inArray) throws IOException {
20866    if (value != null && value.hasValue()) {
20867        prop(name, toString(value.getValue()));
20868    }    
20869    else if (inArray) 
20870      writeNull(name); 
20871  }    
20872
20873  protected void composeUuidExtras(String name, UuidType value, boolean inArray) throws IOException {
20874    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20875      open(inArray ? null : "_"+name);
20876      composeElement(value);
20877      close();
20878    }
20879    else if (inArray) 
20880      writeNull(name); 
20881  }
20882
20883  protected void composeInstantCore(String name, InstantType value, boolean inArray) throws IOException {
20884    if (value != null && value.hasValue()) {
20885        prop(name, value.asStringValue());
20886    }    
20887    else if (inArray) 
20888      writeNull(name); 
20889  }    
20890
20891  protected void composeInstantExtras(String name, InstantType value, boolean inArray) throws IOException {
20892    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20893      open(inArray ? null : "_"+name);
20894      composeElement(value);
20895      close();
20896    }
20897    else if (inArray) 
20898      writeNull(name); 
20899  }
20900
20901  protected void composeBooleanCore(String name, BooleanType value, boolean inArray) throws IOException {
20902    if (value != null && value.hasValue()) {
20903        prop(name, value.getValue());
20904    }    
20905    else if (inArray) 
20906      writeNull(name); 
20907  }    
20908
20909  protected void composeBooleanExtras(String name, BooleanType value, boolean inArray) throws IOException {
20910    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20911      open(inArray ? null : "_"+name);
20912      composeElement(value);
20913      close();
20914    }
20915    else if (inArray) 
20916      writeNull(name); 
20917  }
20918
20919  protected void composeBase64BinaryCore(String name, Base64BinaryType value, boolean inArray) throws IOException {
20920    if (value != null && value.hasValue()) {
20921        prop(name, toString(value.getValue()));
20922    }    
20923    else if (inArray) 
20924      writeNull(name); 
20925  }    
20926
20927  protected void composeBase64BinaryExtras(String name, Base64BinaryType value, boolean inArray) throws IOException {
20928    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20929      open(inArray ? null : "_"+name);
20930      composeElement(value);
20931      close();
20932    }
20933    else if (inArray) 
20934      writeNull(name); 
20935  }
20936
20937  protected void composeUnsignedIntCore(String name, UnsignedIntType value, boolean inArray) throws IOException {
20938    if (value != null && value.hasValue()) {
20939        prop(name, Integer.valueOf(value.getValue()));
20940    }    
20941    else if (inArray) 
20942      writeNull(name); 
20943  }    
20944
20945  protected void composeUnsignedIntExtras(String name, UnsignedIntType value, boolean inArray) throws IOException {
20946    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20947      open(inArray ? null : "_"+name);
20948      composeElement(value);
20949      close();
20950    }
20951    else if (inArray) 
20952      writeNull(name); 
20953  }
20954
20955  protected void composeMarkdownCore(String name, MarkdownType value, boolean inArray) throws IOException {
20956    if (value != null && value.hasValue()) {
20957        prop(name, toString(value.getValue()));
20958    }    
20959    else if (inArray) 
20960      writeNull(name); 
20961  }    
20962
20963  protected void composeMarkdownExtras(String name, MarkdownType value, boolean inArray) throws IOException {
20964    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20965      open(inArray ? null : "_"+name);
20966      composeElement(value);
20967      close();
20968    }
20969    else if (inArray) 
20970      writeNull(name); 
20971  }
20972
20973  protected void composeTimeCore(String name, TimeType value, boolean inArray) throws IOException {
20974    if (value != null && value.hasValue()) {
20975        prop(name, value.asStringValue());
20976    }    
20977    else if (inArray) 
20978      writeNull(name); 
20979  }    
20980
20981  protected void composeTimeExtras(String name, TimeType value, boolean inArray) throws IOException {
20982    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20983      open(inArray ? null : "_"+name);
20984      composeElement(value);
20985      close();
20986    }
20987    else if (inArray) 
20988      writeNull(name); 
20989  }
20990
20991  protected void composeIdCore(String name, IdType value, boolean inArray) throws IOException {
20992    if (value != null && value.hasValue()) {
20993        prop(name, toString(value.getValue()));
20994    }    
20995    else if (inArray) 
20996      writeNull(name); 
20997  }    
20998
20999  protected void composeIdExtras(String name, IdType value, boolean inArray) throws IOException {
21000    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
21001      open(inArray ? null : "_"+name);
21002      composeElement(value);
21003      close();
21004    }
21005    else if (inArray) 
21006      writeNull(name); 
21007  }
21008
21009  protected void composePositiveIntCore(String name, PositiveIntType value, boolean inArray) throws IOException {
21010    if (value != null && value.hasValue()) {
21011        prop(name, Integer.valueOf(value.getValue()));
21012    }    
21013    else if (inArray) 
21014      writeNull(name); 
21015  }    
21016
21017  protected void composePositiveIntExtras(String name, PositiveIntType value, boolean inArray) throws IOException {
21018    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
21019      open(inArray ? null : "_"+name);
21020      composeElement(value);
21021      close();
21022    }
21023    else if (inArray) 
21024      writeNull(name); 
21025  }
21026
21027  protected void composeDecimalCore(String name, DecimalType value, boolean inArray) throws IOException {
21028    if (value != null && value.hasValue()) {
21029        prop(name, value.getValue());
21030    }    
21031    else if (inArray) 
21032      writeNull(name); 
21033  }    
21034
21035  protected void composeDecimalExtras(String name, DecimalType value, boolean inArray) throws IOException {
21036    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
21037      open(inArray ? null : "_"+name);
21038      composeElement(value);
21039      close();
21040    }
21041    else if (inArray) 
21042      writeNull(name); 
21043  }
21044
21045  protected void composeExtension(String name, Extension element) throws IOException {
21046    if (element != null) {
21047      open(name);
21048      composeExtensionInner(element);
21049      close();
21050    }
21051  }
21052
21053  protected void composeExtensionInner(Extension element) throws IOException {
21054      composeElement(element);
21055      if (element.hasUrlElement()) {
21056        composeUriCore("url", element.getUrlElement(), false);
21057        composeUriExtras("url", element.getUrlElement(), false);
21058      }
21059      if (element.hasValue()) {
21060        composeType("value", element.getValue());
21061      }
21062  }
21063
21064  protected void composeNarrative(String name, Narrative element) throws IOException {
21065    if (element != null) {
21066      open(name);
21067      composeNarrativeInner(element);
21068      close();
21069    }
21070  }
21071
21072  protected void composeNarrativeInner(Narrative element) throws IOException {
21073      composeElement(element);
21074      if (element.hasStatusElement()) {
21075        composeEnumerationCore("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
21076        composeEnumerationExtras("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
21077      }
21078      if (element.hasDiv()) {
21079        XhtmlNode node = element.getDiv();
21080        if (node.getNsDecl() == null) {
21081          node.attribute("xmlns", XHTML_NS);
21082        }
21083        composeXhtml("div", node);
21084      }
21085  }
21086
21087  protected void composeDuration(String name, Duration element) throws IOException {
21088    if (element != null) {
21089      open(name);
21090      composeDurationInner(element);
21091      close();
21092    }
21093  }
21094
21095  protected void composeDurationInner(Duration element) throws IOException {
21096      composeQuantityInner(element);
21097  }
21098
21099  protected void composeCount(String name, Count element) throws IOException {
21100    if (element != null) {
21101      open(name);
21102      composeCountInner(element);
21103      close();
21104    }
21105  }
21106
21107  protected void composeCountInner(Count element) throws IOException {
21108      composeQuantityInner(element);
21109  }
21110
21111  protected void composeMoney(String name, Money element) throws IOException {
21112    if (element != null) {
21113      open(name);
21114      composeMoneyInner(element);
21115      close();
21116    }
21117  }
21118
21119  protected void composeMoneyInner(Money element) throws IOException {
21120      composeQuantityInner(element);
21121  }
21122
21123  protected void composeDistance(String name, Distance element) throws IOException {
21124    if (element != null) {
21125      open(name);
21126      composeDistanceInner(element);
21127      close();
21128    }
21129  }
21130
21131  protected void composeDistanceInner(Distance element) throws IOException {
21132      composeQuantityInner(element);
21133  }
21134
21135  protected void composeAge(String name, Age element) throws IOException {
21136    if (element != null) {
21137      open(name);
21138      composeAgeInner(element);
21139      close();
21140    }
21141  }
21142
21143  protected void composeAgeInner(Age element) throws IOException {
21144      composeQuantityInner(element);
21145  }
21146
21147  protected void composeReference(String name, Reference element) throws IOException {
21148    if (element != null) {
21149      open(name);
21150      composeReferenceInner(element);
21151      close();
21152    }
21153  }
21154
21155  protected void composeReferenceInner(Reference element) throws IOException {
21156      composeElement(element);
21157      if (element.hasReferenceElement()) {
21158        composeStringCore("reference", element.getReferenceElement(), false);
21159        composeStringExtras("reference", element.getReferenceElement(), false);
21160      }
21161      if (element.hasIdentifier()) {
21162        composeIdentifier("identifier", element.getIdentifier());
21163      }
21164      if (element.hasDisplayElement()) {
21165        composeStringCore("display", element.getDisplayElement(), false);
21166        composeStringExtras("display", element.getDisplayElement(), false);
21167      }
21168  }
21169
21170  protected void composeQuantity(String name, Quantity element) throws IOException {
21171    if (element != null) {
21172      open(name);
21173      composeQuantityInner(element);
21174      close();
21175    }
21176  }
21177
21178  protected void composeQuantityInner(Quantity element) throws IOException {
21179      composeElement(element);
21180      if (element.hasValueElement()) {
21181        composeDecimalCore("value", element.getValueElement(), false);
21182        composeDecimalExtras("value", element.getValueElement(), false);
21183      }
21184      if (element.hasComparatorElement()) {
21185        composeEnumerationCore("comparator", element.getComparatorElement(), new Quantity.QuantityComparatorEnumFactory(), false);
21186        composeEnumerationExtras("comparator", element.getComparatorElement(), new Quantity.QuantityComparatorEnumFactory(), false);
21187      }
21188      if (element.hasUnitElement()) {
21189        composeStringCore("unit", element.getUnitElement(), false);
21190        composeStringExtras("unit", element.getUnitElement(), false);
21191      }
21192      if (element.hasSystemElement()) {
21193        composeUriCore("system", element.getSystemElement(), false);
21194        composeUriExtras("system", element.getSystemElement(), false);
21195      }
21196      if (element.hasCodeElement()) {
21197        composeCodeCore("code", element.getCodeElement(), false);
21198        composeCodeExtras("code", element.getCodeElement(), false);
21199      }
21200  }
21201
21202  protected void composePeriod(String name, Period element) throws IOException {
21203    if (element != null) {
21204      open(name);
21205      composePeriodInner(element);
21206      close();
21207    }
21208  }
21209
21210  protected void composePeriodInner(Period element) throws IOException {
21211      composeElement(element);
21212      if (element.hasStartElement()) {
21213        composeDateTimeCore("start", element.getStartElement(), false);
21214        composeDateTimeExtras("start", element.getStartElement(), false);
21215      }
21216      if (element.hasEndElement()) {
21217        composeDateTimeCore("end", element.getEndElement(), false);
21218        composeDateTimeExtras("end", element.getEndElement(), false);
21219      }
21220  }
21221
21222  protected void composeAttachment(String name, Attachment element) throws IOException {
21223    if (element != null) {
21224      open(name);
21225      composeAttachmentInner(element);
21226      close();
21227    }
21228  }
21229
21230  protected void composeAttachmentInner(Attachment element) throws IOException {
21231      composeElement(element);
21232      if (element.hasContentTypeElement()) {
21233        composeCodeCore("contentType", element.getContentTypeElement(), false);
21234        composeCodeExtras("contentType", element.getContentTypeElement(), false);
21235      }
21236      if (element.hasLanguageElement()) {
21237        composeCodeCore("language", element.getLanguageElement(), false);
21238        composeCodeExtras("language", element.getLanguageElement(), false);
21239      }
21240      if (element.hasDataElement()) {
21241        composeBase64BinaryCore("data", element.getDataElement(), false);
21242        composeBase64BinaryExtras("data", element.getDataElement(), false);
21243      }
21244      if (element.hasUrlElement()) {
21245        composeUriCore("url", element.getUrlElement(), false);
21246        composeUriExtras("url", element.getUrlElement(), false);
21247      }
21248      if (element.hasSizeElement()) {
21249        composeUnsignedIntCore("size", element.getSizeElement(), false);
21250        composeUnsignedIntExtras("size", element.getSizeElement(), false);
21251      }
21252      if (element.hasHashElement()) {
21253        composeBase64BinaryCore("hash", element.getHashElement(), false);
21254        composeBase64BinaryExtras("hash", element.getHashElement(), false);
21255      }
21256      if (element.hasTitleElement()) {
21257        composeStringCore("title", element.getTitleElement(), false);
21258        composeStringExtras("title", element.getTitleElement(), false);
21259      }
21260      if (element.hasCreationElement()) {
21261        composeDateTimeCore("creation", element.getCreationElement(), false);
21262        composeDateTimeExtras("creation", element.getCreationElement(), false);
21263      }
21264  }
21265
21266  protected void composeRange(String name, Range element) throws IOException {
21267    if (element != null) {
21268      open(name);
21269      composeRangeInner(element);
21270      close();
21271    }
21272  }
21273
21274  protected void composeRangeInner(Range element) throws IOException {
21275      composeElement(element);
21276      if (element.hasLow()) {
21277        composeSimpleQuantity("low", element.getLow());
21278      }
21279      if (element.hasHigh()) {
21280        composeSimpleQuantity("high", element.getHigh());
21281      }
21282  }
21283
21284  protected void composeAnnotation(String name, Annotation element) throws IOException {
21285    if (element != null) {
21286      open(name);
21287      composeAnnotationInner(element);
21288      close();
21289    }
21290  }
21291
21292  protected void composeAnnotationInner(Annotation element) throws IOException {
21293      composeElement(element);
21294      if (element.hasAuthor()) {
21295        composeType("author", element.getAuthor());
21296      }
21297      if (element.hasTimeElement()) {
21298        composeDateTimeCore("time", element.getTimeElement(), false);
21299        composeDateTimeExtras("time", element.getTimeElement(), false);
21300      }
21301      if (element.hasTextElement()) {
21302        composeStringCore("text", element.getTextElement(), false);
21303        composeStringExtras("text", element.getTextElement(), false);
21304      }
21305  }
21306
21307  protected void composeIdentifier(String name, Identifier element) throws IOException {
21308    if (element != null) {
21309      open(name);
21310      composeIdentifierInner(element);
21311      close();
21312    }
21313  }
21314
21315  protected void composeIdentifierInner(Identifier element) throws IOException {
21316      composeElement(element);
21317      if (element.hasUseElement()) {
21318        composeEnumerationCore("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory(), false);
21319        composeEnumerationExtras("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory(), false);
21320      }
21321      if (element.hasType()) {
21322        composeCodeableConcept("type", element.getType());
21323      }
21324      if (element.hasSystemElement()) {
21325        composeUriCore("system", element.getSystemElement(), false);
21326        composeUriExtras("system", element.getSystemElement(), false);
21327      }
21328      if (element.hasValueElement()) {
21329        composeStringCore("value", element.getValueElement(), false);
21330        composeStringExtras("value", element.getValueElement(), false);
21331      }
21332      if (element.hasPeriod()) {
21333        composePeriod("period", element.getPeriod());
21334      }
21335      if (element.hasAssigner()) {
21336        composeReference("assigner", element.getAssigner());
21337      }
21338  }
21339
21340  protected void composeCoding(String name, Coding element) throws IOException {
21341    if (element != null) {
21342      open(name);
21343      composeCodingInner(element);
21344      close();
21345    }
21346  }
21347
21348  protected void composeCodingInner(Coding element) throws IOException {
21349      composeElement(element);
21350      if (element.hasSystemElement()) {
21351        composeUriCore("system", element.getSystemElement(), false);
21352        composeUriExtras("system", element.getSystemElement(), false);
21353      }
21354      if (element.hasVersionElement()) {
21355        composeStringCore("version", element.getVersionElement(), false);
21356        composeStringExtras("version", element.getVersionElement(), false);
21357      }
21358      if (element.hasCodeElement()) {
21359        composeCodeCore("code", element.getCodeElement(), false);
21360        composeCodeExtras("code", element.getCodeElement(), false);
21361      }
21362      if (element.hasDisplayElement()) {
21363        composeStringCore("display", element.getDisplayElement(), false);
21364        composeStringExtras("display", element.getDisplayElement(), false);
21365      }
21366      if (element.hasUserSelectedElement()) {
21367        composeBooleanCore("userSelected", element.getUserSelectedElement(), false);
21368        composeBooleanExtras("userSelected", element.getUserSelectedElement(), false);
21369      }
21370  }
21371
21372  protected void composeSignature(String name, Signature element) throws IOException {
21373    if (element != null) {
21374      open(name);
21375      composeSignatureInner(element);
21376      close();
21377    }
21378  }
21379
21380  protected void composeSignatureInner(Signature element) throws IOException {
21381      composeElement(element);
21382      if (element.hasType()) {
21383        openArray("type");
21384        for (Coding e : element.getType()) 
21385          composeCoding(null, e);
21386        closeArray();
21387      };
21388      if (element.hasWhenElement()) {
21389        composeInstantCore("when", element.getWhenElement(), false);
21390        composeInstantExtras("when", element.getWhenElement(), false);
21391      }
21392      if (element.hasWho()) {
21393        composeType("who", element.getWho());
21394      }
21395      if (element.hasOnBehalfOf()) {
21396        composeType("onBehalfOf", element.getOnBehalfOf());
21397      }
21398      if (element.hasContentTypeElement()) {
21399        composeCodeCore("contentType", element.getContentTypeElement(), false);
21400        composeCodeExtras("contentType", element.getContentTypeElement(), false);
21401      }
21402      if (element.hasBlobElement()) {
21403        composeBase64BinaryCore("blob", element.getBlobElement(), false);
21404        composeBase64BinaryExtras("blob", element.getBlobElement(), false);
21405      }
21406  }
21407
21408  protected void composeSampledData(String name, SampledData element) throws IOException {
21409    if (element != null) {
21410      open(name);
21411      composeSampledDataInner(element);
21412      close();
21413    }
21414  }
21415
21416  protected void composeSampledDataInner(SampledData element) throws IOException {
21417      composeElement(element);
21418      if (element.hasOrigin()) {
21419        composeSimpleQuantity("origin", element.getOrigin());
21420      }
21421      if (element.hasPeriodElement()) {
21422        composeDecimalCore("period", element.getPeriodElement(), false);
21423        composeDecimalExtras("period", element.getPeriodElement(), false);
21424      }
21425      if (element.hasFactorElement()) {
21426        composeDecimalCore("factor", element.getFactorElement(), false);
21427        composeDecimalExtras("factor", element.getFactorElement(), false);
21428      }
21429      if (element.hasLowerLimitElement()) {
21430        composeDecimalCore("lowerLimit", element.getLowerLimitElement(), false);
21431        composeDecimalExtras("lowerLimit", element.getLowerLimitElement(), false);
21432      }
21433      if (element.hasUpperLimitElement()) {
21434        composeDecimalCore("upperLimit", element.getUpperLimitElement(), false);
21435        composeDecimalExtras("upperLimit", element.getUpperLimitElement(), false);
21436      }
21437      if (element.hasDimensionsElement()) {
21438        composePositiveIntCore("dimensions", element.getDimensionsElement(), false);
21439        composePositiveIntExtras("dimensions", element.getDimensionsElement(), false);
21440      }
21441      if (element.hasDataElement()) {
21442        composeStringCore("data", element.getDataElement(), false);
21443        composeStringExtras("data", element.getDataElement(), false);
21444      }
21445  }
21446
21447  protected void composeRatio(String name, Ratio element) throws IOException {
21448    if (element != null) {
21449      open(name);
21450      composeRatioInner(element);
21451      close();
21452    }
21453  }
21454
21455  protected void composeRatioInner(Ratio element) throws IOException {
21456      composeElement(element);
21457      if (element.hasNumerator()) {
21458        composeQuantity("numerator", element.getNumerator());
21459      }
21460      if (element.hasDenominator()) {
21461        composeQuantity("denominator", element.getDenominator());
21462      }
21463  }
21464
21465  protected void composeCodeableConcept(String name, CodeableConcept element) throws IOException {
21466    if (element != null) {
21467      open(name);
21468      composeCodeableConceptInner(element);
21469      close();
21470    }
21471  }
21472
21473  protected void composeCodeableConceptInner(CodeableConcept element) throws IOException {
21474      composeElement(element);
21475      if (element.hasCoding()) {
21476        openArray("coding");
21477        for (Coding e : element.getCoding()) 
21478          composeCoding(null, e);
21479        closeArray();
21480      };
21481      if (element.hasTextElement()) {
21482        composeStringCore("text", element.getTextElement(), false);
21483        composeStringExtras("text", element.getTextElement(), false);
21484      }
21485  }
21486
21487  protected void composeSimpleQuantity(String name, SimpleQuantity element) throws IOException {
21488    if (element != null) {
21489      open(name);
21490      composeSimpleQuantityInner(element);
21491      close();
21492    }
21493  }
21494
21495  protected void composeSimpleQuantityInner(SimpleQuantity element) throws IOException {
21496      composeElement(element);
21497      if (element.hasValueElement()) {
21498        composeDecimalCore("value", element.getValueElement(), false);
21499        composeDecimalExtras("value", element.getValueElement(), false);
21500      }
21501      if (element.hasComparatorElement()) {
21502        composeEnumerationCore("comparator", element.getComparatorElement(), new SimpleQuantity.QuantityComparatorEnumFactory(), false);
21503        composeEnumerationExtras("comparator", element.getComparatorElement(), new SimpleQuantity.QuantityComparatorEnumFactory(), false);
21504      }
21505      if (element.hasUnitElement()) {
21506        composeStringCore("unit", element.getUnitElement(), false);
21507        composeStringExtras("unit", element.getUnitElement(), false);
21508      }
21509      if (element.hasSystemElement()) {
21510        composeUriCore("system", element.getSystemElement(), false);
21511        composeUriExtras("system", element.getSystemElement(), false);
21512      }
21513      if (element.hasCodeElement()) {
21514        composeCodeCore("code", element.getCodeElement(), false);
21515        composeCodeExtras("code", element.getCodeElement(), false);
21516      }
21517  }
21518
21519  protected void composeMeta(String name, Meta element) throws IOException {
21520    if (element != null) {
21521      open(name);
21522      composeMetaInner(element);
21523      close();
21524    }
21525  }
21526
21527  protected void composeMetaInner(Meta element) throws IOException {
21528      composeElement(element);
21529      if (element.hasVersionIdElement()) {
21530        composeIdCore("versionId", element.getVersionIdElement(), false);
21531        composeIdExtras("versionId", element.getVersionIdElement(), false);
21532      }
21533      if (element.hasLastUpdatedElement()) {
21534        composeInstantCore("lastUpdated", element.getLastUpdatedElement(), false);
21535        composeInstantExtras("lastUpdated", element.getLastUpdatedElement(), false);
21536      }
21537      if (element.hasProfile()) {
21538        openArray("profile");
21539        for (UriType e : element.getProfile()) 
21540          composeUriCore(null, e, true);
21541        closeArray();
21542        if (anyHasExtras(element.getProfile())) {
21543          openArray("_profile");
21544          for (UriType e : element.getProfile()) 
21545            composeUriExtras(null, e, true);
21546          closeArray();
21547        }
21548      };
21549      if (element.hasSecurity()) {
21550        openArray("security");
21551        for (Coding e : element.getSecurity()) 
21552          composeCoding(null, e);
21553        closeArray();
21554      };
21555      if (element.hasTag()) {
21556        openArray("tag");
21557        for (Coding e : element.getTag()) 
21558          composeCoding(null, e);
21559        closeArray();
21560      };
21561  }
21562
21563  protected void composeAddress(String name, Address element) throws IOException {
21564    if (element != null) {
21565      open(name);
21566      composeAddressInner(element);
21567      close();
21568    }
21569  }
21570
21571  protected void composeAddressInner(Address element) throws IOException {
21572      composeElement(element);
21573      if (element.hasUseElement()) {
21574        composeEnumerationCore("use", element.getUseElement(), new Address.AddressUseEnumFactory(), false);
21575        composeEnumerationExtras("use", element.getUseElement(), new Address.AddressUseEnumFactory(), false);
21576      }
21577      if (element.hasTypeElement()) {
21578        composeEnumerationCore("type", element.getTypeElement(), new Address.AddressTypeEnumFactory(), false);
21579        composeEnumerationExtras("type", element.getTypeElement(), new Address.AddressTypeEnumFactory(), false);
21580      }
21581      if (element.hasTextElement()) {
21582        composeStringCore("text", element.getTextElement(), false);
21583        composeStringExtras("text", element.getTextElement(), false);
21584      }
21585      if (element.hasLine()) {
21586        openArray("line");
21587        for (StringType e : element.getLine()) 
21588          composeStringCore(null, e, true);
21589        closeArray();
21590        if (anyHasExtras(element.getLine())) {
21591          openArray("_line");
21592          for (StringType e : element.getLine()) 
21593            composeStringExtras(null, e, true);
21594          closeArray();
21595        }
21596      };
21597      if (element.hasCityElement()) {
21598        composeStringCore("city", element.getCityElement(), false);
21599        composeStringExtras("city", element.getCityElement(), false);
21600      }
21601      if (element.hasDistrictElement()) {
21602        composeStringCore("district", element.getDistrictElement(), false);
21603        composeStringExtras("district", element.getDistrictElement(), false);
21604      }
21605      if (element.hasStateElement()) {
21606        composeStringCore("state", element.getStateElement(), false);
21607        composeStringExtras("state", element.getStateElement(), false);
21608      }
21609      if (element.hasPostalCodeElement()) {
21610        composeStringCore("postalCode", element.getPostalCodeElement(), false);
21611        composeStringExtras("postalCode", element.getPostalCodeElement(), false);
21612      }
21613      if (element.hasCountryElement()) {
21614        composeStringCore("country", element.getCountryElement(), false);
21615        composeStringExtras("country", element.getCountryElement(), false);
21616      }
21617      if (element.hasPeriod()) {
21618        composePeriod("period", element.getPeriod());
21619      }
21620  }
21621
21622  protected void composeTriggerDefinition(String name, TriggerDefinition element) throws IOException {
21623    if (element != null) {
21624      open(name);
21625      composeTriggerDefinitionInner(element);
21626      close();
21627    }
21628  }
21629
21630  protected void composeTriggerDefinitionInner(TriggerDefinition element) throws IOException {
21631      composeElement(element);
21632      if (element.hasTypeElement()) {
21633        composeEnumerationCore("type", element.getTypeElement(), new TriggerDefinition.TriggerTypeEnumFactory(), false);
21634        composeEnumerationExtras("type", element.getTypeElement(), new TriggerDefinition.TriggerTypeEnumFactory(), false);
21635      }
21636      if (element.hasEventNameElement()) {
21637        composeStringCore("eventName", element.getEventNameElement(), false);
21638        composeStringExtras("eventName", element.getEventNameElement(), false);
21639      }
21640      if (element.hasEventTiming()) {
21641        composeType("eventTiming", element.getEventTiming());
21642      }
21643      if (element.hasEventData()) {
21644        composeDataRequirement("eventData", element.getEventData());
21645      }
21646  }
21647
21648  protected void composeContributor(String name, Contributor element) throws IOException {
21649    if (element != null) {
21650      open(name);
21651      composeContributorInner(element);
21652      close();
21653    }
21654  }
21655
21656  protected void composeContributorInner(Contributor element) throws IOException {
21657      composeElement(element);
21658      if (element.hasTypeElement()) {
21659        composeEnumerationCore("type", element.getTypeElement(), new Contributor.ContributorTypeEnumFactory(), false);
21660        composeEnumerationExtras("type", element.getTypeElement(), new Contributor.ContributorTypeEnumFactory(), false);
21661      }
21662      if (element.hasNameElement()) {
21663        composeStringCore("name", element.getNameElement(), false);
21664        composeStringExtras("name", element.getNameElement(), false);
21665      }
21666      if (element.hasContact()) {
21667        openArray("contact");
21668        for (ContactDetail e : element.getContact()) 
21669          composeContactDetail(null, e);
21670        closeArray();
21671      };
21672  }
21673
21674  protected void composeDataRequirement(String name, DataRequirement element) throws IOException {
21675    if (element != null) {
21676      open(name);
21677      composeDataRequirementInner(element);
21678      close();
21679    }
21680  }
21681
21682  protected void composeDataRequirementInner(DataRequirement element) throws IOException {
21683      composeElement(element);
21684      if (element.hasTypeElement()) {
21685        composeCodeCore("type", element.getTypeElement(), false);
21686        composeCodeExtras("type", element.getTypeElement(), false);
21687      }
21688      if (element.hasProfile()) {
21689        openArray("profile");
21690        for (UriType e : element.getProfile()) 
21691          composeUriCore(null, e, true);
21692        closeArray();
21693        if (anyHasExtras(element.getProfile())) {
21694          openArray("_profile");
21695          for (UriType e : element.getProfile()) 
21696            composeUriExtras(null, e, true);
21697          closeArray();
21698        }
21699      };
21700      if (element.hasMustSupport()) {
21701        openArray("mustSupport");
21702        for (StringType e : element.getMustSupport()) 
21703          composeStringCore(null, e, true);
21704        closeArray();
21705        if (anyHasExtras(element.getMustSupport())) {
21706          openArray("_mustSupport");
21707          for (StringType e : element.getMustSupport()) 
21708            composeStringExtras(null, e, true);
21709          closeArray();
21710        }
21711      };
21712      if (element.hasCodeFilter()) {
21713        openArray("codeFilter");
21714        for (DataRequirement.DataRequirementCodeFilterComponent e : element.getCodeFilter()) 
21715          composeDataRequirementDataRequirementCodeFilterComponent(null, e);
21716        closeArray();
21717      };
21718      if (element.hasDateFilter()) {
21719        openArray("dateFilter");
21720        for (DataRequirement.DataRequirementDateFilterComponent e : element.getDateFilter()) 
21721          composeDataRequirementDataRequirementDateFilterComponent(null, e);
21722        closeArray();
21723      };
21724  }
21725
21726  protected void composeDataRequirementDataRequirementCodeFilterComponent(String name, DataRequirement.DataRequirementCodeFilterComponent element) throws IOException {
21727    if (element != null) {
21728      open(name);
21729      composeDataRequirementDataRequirementCodeFilterComponentInner(element);
21730      close();
21731    }
21732  }
21733
21734  protected void composeDataRequirementDataRequirementCodeFilterComponentInner(DataRequirement.DataRequirementCodeFilterComponent element) throws IOException {
21735      composeElement(element);
21736      if (element.hasPathElement()) {
21737        composeStringCore("path", element.getPathElement(), false);
21738        composeStringExtras("path", element.getPathElement(), false);
21739      }
21740      if (element.hasValueSet()) {
21741        composeType("valueSet", element.getValueSet());
21742      }
21743      if (element.hasValueCode()) {
21744        openArray("valueCode");
21745        for (CodeType e : element.getValueCode()) 
21746          composeCodeCore(null, e, true);
21747        closeArray();
21748        if (anyHasExtras(element.getValueCode())) {
21749          openArray("_valueCode");
21750          for (CodeType e : element.getValueCode()) 
21751            composeCodeExtras(null, e, true);
21752          closeArray();
21753        }
21754      };
21755      if (element.hasValueCoding()) {
21756        openArray("valueCoding");
21757        for (Coding e : element.getValueCoding()) 
21758          composeCoding(null, e);
21759        closeArray();
21760      };
21761      if (element.hasValueCodeableConcept()) {
21762        openArray("valueCodeableConcept");
21763        for (CodeableConcept e : element.getValueCodeableConcept()) 
21764          composeCodeableConcept(null, e);
21765        closeArray();
21766      };
21767  }
21768
21769  protected void composeDataRequirementDataRequirementDateFilterComponent(String name, DataRequirement.DataRequirementDateFilterComponent element) throws IOException {
21770    if (element != null) {
21771      open(name);
21772      composeDataRequirementDataRequirementDateFilterComponentInner(element);
21773      close();
21774    }
21775  }
21776
21777  protected void composeDataRequirementDataRequirementDateFilterComponentInner(DataRequirement.DataRequirementDateFilterComponent element) throws IOException {
21778      composeElement(element);
21779      if (element.hasPathElement()) {
21780        composeStringCore("path", element.getPathElement(), false);
21781        composeStringExtras("path", element.getPathElement(), false);
21782      }
21783      if (element.hasValue()) {
21784        composeType("value", element.getValue());
21785      }
21786  }
21787
21788  protected void composeDosage(String name, Dosage element) throws IOException {
21789    if (element != null) {
21790      open(name);
21791      composeDosageInner(element);
21792      close();
21793    }
21794  }
21795
21796  protected void composeDosageInner(Dosage element) throws IOException {
21797      composeElement(element);
21798      if (element.hasSequenceElement()) {
21799        composeIntegerCore("sequence", element.getSequenceElement(), false);
21800        composeIntegerExtras("sequence", element.getSequenceElement(), false);
21801      }
21802      if (element.hasTextElement()) {
21803        composeStringCore("text", element.getTextElement(), false);
21804        composeStringExtras("text", element.getTextElement(), false);
21805      }
21806      if (element.hasAdditionalInstruction()) {
21807        openArray("additionalInstruction");
21808        for (CodeableConcept e : element.getAdditionalInstruction()) 
21809          composeCodeableConcept(null, e);
21810        closeArray();
21811      };
21812      if (element.hasPatientInstructionElement()) {
21813        composeStringCore("patientInstruction", element.getPatientInstructionElement(), false);
21814        composeStringExtras("patientInstruction", element.getPatientInstructionElement(), false);
21815      }
21816      if (element.hasTiming()) {
21817        composeTiming("timing", element.getTiming());
21818      }
21819      if (element.hasAsNeeded()) {
21820        composeType("asNeeded", element.getAsNeeded());
21821      }
21822      if (element.hasSite()) {
21823        composeCodeableConcept("site", element.getSite());
21824      }
21825      if (element.hasRoute()) {
21826        composeCodeableConcept("route", element.getRoute());
21827      }
21828      if (element.hasMethod()) {
21829        composeCodeableConcept("method", element.getMethod());
21830      }
21831      if (element.hasDose()) {
21832        composeType("dose", element.getDose());
21833      }
21834      if (element.hasMaxDosePerPeriod()) {
21835        composeRatio("maxDosePerPeriod", element.getMaxDosePerPeriod());
21836      }
21837      if (element.hasMaxDosePerAdministration()) {
21838        composeSimpleQuantity("maxDosePerAdministration", element.getMaxDosePerAdministration());
21839      }
21840      if (element.hasMaxDosePerLifetime()) {
21841        composeSimpleQuantity("maxDosePerLifetime", element.getMaxDosePerLifetime());
21842      }
21843      if (element.hasRate()) {
21844        composeType("rate", element.getRate());
21845      }
21846  }
21847
21848  protected void composeRelatedArtifact(String name, RelatedArtifact element) throws IOException {
21849    if (element != null) {
21850      open(name);
21851      composeRelatedArtifactInner(element);
21852      close();
21853    }
21854  }
21855
21856  protected void composeRelatedArtifactInner(RelatedArtifact element) throws IOException {
21857      composeElement(element);
21858      if (element.hasTypeElement()) {
21859        composeEnumerationCore("type", element.getTypeElement(), new RelatedArtifact.RelatedArtifactTypeEnumFactory(), false);
21860        composeEnumerationExtras("type", element.getTypeElement(), new RelatedArtifact.RelatedArtifactTypeEnumFactory(), false);
21861      }
21862      if (element.hasDisplayElement()) {
21863        composeStringCore("display", element.getDisplayElement(), false);
21864        composeStringExtras("display", element.getDisplayElement(), false);
21865      }
21866      if (element.hasCitationElement()) {
21867        composeStringCore("citation", element.getCitationElement(), false);
21868        composeStringExtras("citation", element.getCitationElement(), false);
21869      }
21870      if (element.hasUrlElement()) {
21871        composeUriCore("url", element.getUrlElement(), false);
21872        composeUriExtras("url", element.getUrlElement(), false);
21873      }
21874      if (element.hasDocument()) {
21875        composeAttachment("document", element.getDocument());
21876      }
21877      if (element.hasResource()) {
21878        composeReference("resource", element.getResource());
21879      }
21880  }
21881
21882  protected void composeContactDetail(String name, ContactDetail element) throws IOException {
21883    if (element != null) {
21884      open(name);
21885      composeContactDetailInner(element);
21886      close();
21887    }
21888  }
21889
21890  protected void composeContactDetailInner(ContactDetail element) throws IOException {
21891      composeElement(element);
21892      if (element.hasNameElement()) {
21893        composeStringCore("name", element.getNameElement(), false);
21894        composeStringExtras("name", element.getNameElement(), false);
21895      }
21896      if (element.hasTelecom()) {
21897        openArray("telecom");
21898        for (ContactPoint e : element.getTelecom()) 
21899          composeContactPoint(null, e);
21900        closeArray();
21901      };
21902  }
21903
21904  protected void composeHumanName(String name, HumanName element) throws IOException {
21905    if (element != null) {
21906      open(name);
21907      composeHumanNameInner(element);
21908      close();
21909    }
21910  }
21911
21912  protected void composeHumanNameInner(HumanName element) throws IOException {
21913      composeElement(element);
21914      if (element.hasUseElement()) {
21915        composeEnumerationCore("use", element.getUseElement(), new HumanName.NameUseEnumFactory(), false);
21916        composeEnumerationExtras("use", element.getUseElement(), new HumanName.NameUseEnumFactory(), false);
21917      }
21918      if (element.hasTextElement()) {
21919        composeStringCore("text", element.getTextElement(), false);
21920        composeStringExtras("text", element.getTextElement(), false);
21921      }
21922      if (element.hasFamilyElement()) {
21923        composeStringCore("family", element.getFamilyElement(), false);
21924        composeStringExtras("family", element.getFamilyElement(), false);
21925      }
21926      if (element.hasGiven()) {
21927        openArray("given");
21928        for (StringType e : element.getGiven()) 
21929          composeStringCore(null, e, true);
21930        closeArray();
21931        if (anyHasExtras(element.getGiven())) {
21932          openArray("_given");
21933          for (StringType e : element.getGiven()) 
21934            composeStringExtras(null, e, true);
21935          closeArray();
21936        }
21937      };
21938      if (element.hasPrefix()) {
21939        openArray("prefix");
21940        for (StringType e : element.getPrefix()) 
21941          composeStringCore(null, e, true);
21942        closeArray();
21943        if (anyHasExtras(element.getPrefix())) {
21944          openArray("_prefix");
21945          for (StringType e : element.getPrefix()) 
21946            composeStringExtras(null, e, true);
21947          closeArray();
21948        }
21949      };
21950      if (element.hasSuffix()) {
21951        openArray("suffix");
21952        for (StringType e : element.getSuffix()) 
21953          composeStringCore(null, e, true);
21954        closeArray();
21955        if (anyHasExtras(element.getSuffix())) {
21956          openArray("_suffix");
21957          for (StringType e : element.getSuffix()) 
21958            composeStringExtras(null, e, true);
21959          closeArray();
21960        }
21961      };
21962      if (element.hasPeriod()) {
21963        composePeriod("period", element.getPeriod());
21964      }
21965  }
21966
21967  protected void composeContactPoint(String name, ContactPoint element) throws IOException {
21968    if (element != null) {
21969      open(name);
21970      composeContactPointInner(element);
21971      close();
21972    }
21973  }
21974
21975  protected void composeContactPointInner(ContactPoint element) throws IOException {
21976      composeElement(element);
21977      if (element.hasSystemElement()) {
21978        composeEnumerationCore("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory(), false);
21979        composeEnumerationExtras("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory(), false);
21980      }
21981      if (element.hasValueElement()) {
21982        composeStringCore("value", element.getValueElement(), false);
21983        composeStringExtras("value", element.getValueElement(), false);
21984      }
21985      if (element.hasUseElement()) {
21986        composeEnumerationCore("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory(), false);
21987        composeEnumerationExtras("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory(), false);
21988      }
21989      if (element.hasRankElement()) {
21990        composePositiveIntCore("rank", element.getRankElement(), false);
21991        composePositiveIntExtras("rank", element.getRankElement(), false);
21992      }
21993      if (element.hasPeriod()) {
21994        composePeriod("period", element.getPeriod());
21995      }
21996  }
21997
21998  protected void composeUsageContext(String name, UsageContext element) throws IOException {
21999    if (element != null) {
22000      open(name);
22001      composeUsageContextInner(element);
22002      close();
22003    }
22004  }
22005
22006  protected void composeUsageContextInner(UsageContext element) throws IOException {
22007      composeElement(element);
22008      if (element.hasCode()) {
22009        composeCoding("code", element.getCode());
22010      }
22011      if (element.hasValue()) {
22012        composeType("value", element.getValue());
22013      }
22014  }
22015
22016  protected void composeTiming(String name, Timing element) throws IOException {
22017    if (element != null) {
22018      open(name);
22019      composeTimingInner(element);
22020      close();
22021    }
22022  }
22023
22024  protected void composeTimingInner(Timing element) throws IOException {
22025      composeElement(element);
22026      if (element.hasEvent()) {
22027        openArray("event");
22028        for (DateTimeType e : element.getEvent()) 
22029          composeDateTimeCore(null, e, true);
22030        closeArray();
22031        if (anyHasExtras(element.getEvent())) {
22032          openArray("_event");
22033          for (DateTimeType e : element.getEvent()) 
22034            composeDateTimeExtras(null, e, true);
22035          closeArray();
22036        }
22037      };
22038      if (element.hasRepeat()) {
22039        composeTimingTimingRepeatComponent("repeat", element.getRepeat());
22040      }
22041      if (element.hasCode()) {
22042        composeCodeableConcept("code", element.getCode());
22043      }
22044  }
22045
22046  protected void composeTimingTimingRepeatComponent(String name, Timing.TimingRepeatComponent element) throws IOException {
22047    if (element != null) {
22048      open(name);
22049      composeTimingTimingRepeatComponentInner(element);
22050      close();
22051    }
22052  }
22053
22054  protected void composeTimingTimingRepeatComponentInner(Timing.TimingRepeatComponent element) throws IOException {
22055      composeElement(element);
22056      if (element.hasBounds()) {
22057        composeType("bounds", element.getBounds());
22058      }
22059      if (element.hasCountElement()) {
22060        composeIntegerCore("count", element.getCountElement(), false);
22061        composeIntegerExtras("count", element.getCountElement(), false);
22062      }
22063      if (element.hasCountMaxElement()) {
22064        composeIntegerCore("countMax", element.getCountMaxElement(), false);
22065        composeIntegerExtras("countMax", element.getCountMaxElement(), false);
22066      }
22067      if (element.hasDurationElement()) {
22068        composeDecimalCore("duration", element.getDurationElement(), false);
22069        composeDecimalExtras("duration", element.getDurationElement(), false);
22070      }
22071      if (element.hasDurationMaxElement()) {
22072        composeDecimalCore("durationMax", element.getDurationMaxElement(), false);
22073        composeDecimalExtras("durationMax", element.getDurationMaxElement(), false);
22074      }
22075      if (element.hasDurationUnitElement()) {
22076        composeEnumerationCore("durationUnit", element.getDurationUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
22077        composeEnumerationExtras("durationUnit", element.getDurationUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
22078      }
22079      if (element.hasFrequencyElement()) {
22080        composeIntegerCore("frequency", element.getFrequencyElement(), false);
22081        composeIntegerExtras("frequency", element.getFrequencyElement(), false);
22082      }
22083      if (element.hasFrequencyMaxElement()) {
22084        composeIntegerCore("frequencyMax", element.getFrequencyMaxElement(), false);
22085        composeIntegerExtras("frequencyMax", element.getFrequencyMaxElement(), false);
22086      }
22087      if (element.hasPeriodElement()) {
22088        composeDecimalCore("period", element.getPeriodElement(), false);
22089        composeDecimalExtras("period", element.getPeriodElement(), false);
22090      }
22091      if (element.hasPeriodMaxElement()) {
22092        composeDecimalCore("periodMax", element.getPeriodMaxElement(), false);
22093        composeDecimalExtras("periodMax", element.getPeriodMaxElement(), false);
22094      }
22095      if (element.hasPeriodUnitElement()) {
22096        composeEnumerationCore("periodUnit", element.getPeriodUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
22097        composeEnumerationExtras("periodUnit", element.getPeriodUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
22098      }
22099      if (element.hasDayOfWeek()) {
22100        openArray("dayOfWeek");
22101        for (Enumeration<Timing.DayOfWeek> e : element.getDayOfWeek()) 
22102          composeEnumerationCore(null, e, new Timing.DayOfWeekEnumFactory(), true);
22103        closeArray();
22104        if (anyHasExtras(element.getDayOfWeek())) {
22105          openArray("_dayOfWeek");
22106          for (Enumeration<Timing.DayOfWeek> e : element.getDayOfWeek()) 
22107            composeEnumerationExtras(null, e, new Timing.DayOfWeekEnumFactory(), true);
22108          closeArray();
22109        }
22110      };
22111      if (element.hasTimeOfDay()) {
22112        openArray("timeOfDay");
22113        for (TimeType e : element.getTimeOfDay()) 
22114          composeTimeCore(null, e, true);
22115        closeArray();
22116        if (anyHasExtras(element.getTimeOfDay())) {
22117          openArray("_timeOfDay");
22118          for (TimeType e : element.getTimeOfDay()) 
22119            composeTimeExtras(null, e, true);
22120          closeArray();
22121        }
22122      };
22123      if (element.hasWhen()) {
22124        openArray("when");
22125        for (Enumeration<Timing.EventTiming> e : element.getWhen()) 
22126          composeEnumerationCore(null, e, new Timing.EventTimingEnumFactory(), true);
22127        closeArray();
22128        if (anyHasExtras(element.getWhen())) {
22129          openArray("_when");
22130          for (Enumeration<Timing.EventTiming> e : element.getWhen()) 
22131            composeEnumerationExtras(null, e, new Timing.EventTimingEnumFactory(), true);
22132          closeArray();
22133        }
22134      };
22135      if (element.hasOffsetElement()) {
22136        composeUnsignedIntCore("offset", element.getOffsetElement(), false);
22137        composeUnsignedIntExtras("offset", element.getOffsetElement(), false);
22138      }
22139  }
22140
22141  protected void composeElementDefinition(String name, ElementDefinition element) throws IOException {
22142    if (element != null) {
22143      open(name);
22144      composeElementDefinitionInner(element);
22145      close();
22146    }
22147  }
22148
22149  protected void composeElementDefinitionInner(ElementDefinition element) throws IOException {
22150      composeElement(element);
22151      if (element.hasPathElement()) {
22152        composeStringCore("path", element.getPathElement(), false);
22153        composeStringExtras("path", element.getPathElement(), false);
22154      }
22155      if (element.hasRepresentation()) {
22156        openArray("representation");
22157        for (Enumeration<ElementDefinition.PropertyRepresentation> e : element.getRepresentation()) 
22158          composeEnumerationCore(null, e, new ElementDefinition.PropertyRepresentationEnumFactory(), true);
22159        closeArray();
22160        if (anyHasExtras(element.getRepresentation())) {
22161          openArray("_representation");
22162          for (Enumeration<ElementDefinition.PropertyRepresentation> e : element.getRepresentation()) 
22163            composeEnumerationExtras(null, e, new ElementDefinition.PropertyRepresentationEnumFactory(), true);
22164          closeArray();
22165        }
22166      };
22167      if (element.hasSliceNameElement()) {
22168        composeStringCore("sliceName", element.getSliceNameElement(), false);
22169        composeStringExtras("sliceName", element.getSliceNameElement(), false);
22170      }
22171      if (element.hasLabelElement()) {
22172        composeStringCore("label", element.getLabelElement(), false);
22173        composeStringExtras("label", element.getLabelElement(), false);
22174      }
22175      if (element.hasCode()) {
22176        openArray("code");
22177        for (Coding e : element.getCode()) 
22178          composeCoding(null, e);
22179        closeArray();
22180      };
22181      if (element.hasSlicing()) {
22182        composeElementDefinitionElementDefinitionSlicingComponent("slicing", element.getSlicing());
22183      }
22184      if (element.hasShortElement()) {
22185        composeStringCore("short", element.getShortElement(), false);
22186        composeStringExtras("short", element.getShortElement(), false);
22187      }
22188      if (element.hasDefinitionElement()) {
22189        composeMarkdownCore("definition", element.getDefinitionElement(), false);
22190        composeMarkdownExtras("definition", element.getDefinitionElement(), false);
22191      }
22192      if (element.hasCommentElement()) {
22193        composeMarkdownCore("comment", element.getCommentElement(), false);
22194        composeMarkdownExtras("comment", element.getCommentElement(), false);
22195      }
22196      if (element.hasRequirementsElement()) {
22197        composeMarkdownCore("requirements", element.getRequirementsElement(), false);
22198        composeMarkdownExtras("requirements", element.getRequirementsElement(), false);
22199      }
22200      if (element.hasAlias()) {
22201        openArray("alias");
22202        for (StringType e : element.getAlias()) 
22203          composeStringCore(null, e, true);
22204        closeArray();
22205        if (anyHasExtras(element.getAlias())) {
22206          openArray("_alias");
22207          for (StringType e : element.getAlias()) 
22208            composeStringExtras(null, e, true);
22209          closeArray();
22210        }
22211      };
22212      if (element.hasMinElement()) {
22213        composeUnsignedIntCore("min", element.getMinElement(), false);
22214        composeUnsignedIntExtras("min", element.getMinElement(), false);
22215      }
22216      if (element.hasMaxElement()) {
22217        composeStringCore("max", element.getMaxElement(), false);
22218        composeStringExtras("max", element.getMaxElement(), false);
22219      }
22220      if (element.hasBase()) {
22221        composeElementDefinitionElementDefinitionBaseComponent("base", element.getBase());
22222      }
22223      if (element.hasContentReferenceElement()) {
22224        composeUriCore("contentReference", element.getContentReferenceElement(), false);
22225        composeUriExtras("contentReference", element.getContentReferenceElement(), false);
22226      }
22227      if (element.hasType()) {
22228        openArray("type");
22229        for (ElementDefinition.TypeRefComponent e : element.getType()) 
22230          composeElementDefinitionTypeRefComponent(null, e);
22231        closeArray();
22232      };
22233      if (element.hasDefaultValue()) {
22234        composeType("defaultValue", element.getDefaultValue());
22235      }
22236      if (element.hasMeaningWhenMissingElement()) {
22237        composeMarkdownCore("meaningWhenMissing", element.getMeaningWhenMissingElement(), false);
22238        composeMarkdownExtras("meaningWhenMissing", element.getMeaningWhenMissingElement(), false);
22239      }
22240      if (element.hasOrderMeaningElement()) {
22241        composeStringCore("orderMeaning", element.getOrderMeaningElement(), false);
22242        composeStringExtras("orderMeaning", element.getOrderMeaningElement(), false);
22243      }
22244      if (element.hasFixed()) {
22245        composeType("fixed", element.getFixed());
22246      }
22247      if (element.hasPattern()) {
22248        composeType("pattern", element.getPattern());
22249      }
22250      if (element.hasExample()) {
22251        openArray("example");
22252        for (ElementDefinition.ElementDefinitionExampleComponent e : element.getExample()) 
22253          composeElementDefinitionElementDefinitionExampleComponent(null, e);
22254        closeArray();
22255      };
22256      if (element.hasMinValue()) {
22257        composeType("minValue", element.getMinValue());
22258      }
22259      if (element.hasMaxValue()) {
22260        composeType("maxValue", element.getMaxValue());
22261      }
22262      if (element.hasMaxLengthElement()) {
22263        composeIntegerCore("maxLength", element.getMaxLengthElement(), false);
22264        composeIntegerExtras("maxLength", element.getMaxLengthElement(), false);
22265      }
22266      if (element.hasCondition()) {
22267        openArray("condition");
22268        for (IdType e : element.getCondition()) 
22269          composeIdCore(null, e, true);
22270        closeArray();
22271        if (anyHasExtras(element.getCondition())) {
22272          openArray("_condition");
22273          for (IdType e : element.getCondition()) 
22274            composeIdExtras(null, e, true);
22275          closeArray();
22276        }
22277      };
22278      if (element.hasConstraint()) {
22279        openArray("constraint");
22280        for (ElementDefinition.ElementDefinitionConstraintComponent e : element.getConstraint()) 
22281          composeElementDefinitionElementDefinitionConstraintComponent(null, e);
22282        closeArray();
22283      };
22284      if (element.hasMustSupportElement()) {
22285        composeBooleanCore("mustSupport", element.getMustSupportElement(), false);
22286        composeBooleanExtras("mustSupport", element.getMustSupportElement(), false);
22287      }
22288      if (element.hasIsModifierElement()) {
22289        composeBooleanCore("isModifier", element.getIsModifierElement(), false);
22290        composeBooleanExtras("isModifier", element.getIsModifierElement(), false);
22291      }
22292      if (element.hasIsSummaryElement()) {
22293        composeBooleanCore("isSummary", element.getIsSummaryElement(), false);
22294        composeBooleanExtras("isSummary", element.getIsSummaryElement(), false);
22295      }
22296      if (element.hasBinding()) {
22297        composeElementDefinitionElementDefinitionBindingComponent("binding", element.getBinding());
22298      }
22299      if (element.hasMapping()) {
22300        openArray("mapping");
22301        for (ElementDefinition.ElementDefinitionMappingComponent e : element.getMapping()) 
22302          composeElementDefinitionElementDefinitionMappingComponent(null, e);
22303        closeArray();
22304      };
22305  }
22306
22307  protected void composeElementDefinitionElementDefinitionSlicingComponent(String name, ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
22308    if (element != null) {
22309      open(name);
22310      composeElementDefinitionElementDefinitionSlicingComponentInner(element);
22311      close();
22312    }
22313  }
22314
22315  protected void composeElementDefinitionElementDefinitionSlicingComponentInner(ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
22316      composeElement(element);
22317      if (element.hasDiscriminator()) {
22318        openArray("discriminator");
22319        for (ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent e : element.getDiscriminator()) 
22320          composeElementDefinitionElementDefinitionSlicingDiscriminatorComponent(null, e);
22321        closeArray();
22322      };
22323      if (element.hasDescriptionElement()) {
22324        composeStringCore("description", element.getDescriptionElement(), false);
22325        composeStringExtras("description", element.getDescriptionElement(), false);
22326      }
22327      if (element.hasOrderedElement()) {
22328        composeBooleanCore("ordered", element.getOrderedElement(), false);
22329        composeBooleanExtras("ordered", element.getOrderedElement(), false);
22330      }
22331      if (element.hasRulesElement()) {
22332        composeEnumerationCore("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory(), false);
22333        composeEnumerationExtras("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory(), false);
22334      }
22335  }
22336
22337  protected void composeElementDefinitionElementDefinitionSlicingDiscriminatorComponent(String name, ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent element) throws IOException {
22338    if (element != null) {
22339      open(name);
22340      composeElementDefinitionElementDefinitionSlicingDiscriminatorComponentInner(element);
22341      close();
22342    }
22343  }
22344
22345  protected void composeElementDefinitionElementDefinitionSlicingDiscriminatorComponentInner(ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent element) throws IOException {
22346      composeElement(element);
22347      if (element.hasTypeElement()) {
22348        composeEnumerationCore("type", element.getTypeElement(), new ElementDefinition.DiscriminatorTypeEnumFactory(), false);
22349        composeEnumerationExtras("type", element.getTypeElement(), new ElementDefinition.DiscriminatorTypeEnumFactory(), false);
22350      }
22351      if (element.hasPathElement()) {
22352        composeStringCore("path", element.getPathElement(), false);
22353        composeStringExtras("path", element.getPathElement(), false);
22354      }
22355  }
22356
22357  protected void composeElementDefinitionElementDefinitionBaseComponent(String name, ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
22358    if (element != null) {
22359      open(name);
22360      composeElementDefinitionElementDefinitionBaseComponentInner(element);
22361      close();
22362    }
22363  }
22364
22365  protected void composeElementDefinitionElementDefinitionBaseComponentInner(ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
22366      composeElement(element);
22367      if (element.hasPathElement()) {
22368        composeStringCore("path", element.getPathElement(), false);
22369        composeStringExtras("path", element.getPathElement(), false);
22370      }
22371      if (element.hasMinElement()) {
22372        composeUnsignedIntCore("min", element.getMinElement(), false);
22373        composeUnsignedIntExtras("min", element.getMinElement(), false);
22374      }
22375      if (element.hasMaxElement()) {
22376        composeStringCore("max", element.getMaxElement(), false);
22377        composeStringExtras("max", element.getMaxElement(), false);
22378      }
22379  }
22380
22381  protected void composeElementDefinitionTypeRefComponent(String name, ElementDefinition.TypeRefComponent element) throws IOException {
22382    if (element != null) {
22383      open(name);
22384      composeElementDefinitionTypeRefComponentInner(element);
22385      close();
22386    }
22387  }
22388
22389  protected void composeElementDefinitionTypeRefComponentInner(ElementDefinition.TypeRefComponent element) throws IOException {
22390      composeElement(element);
22391      if (element.hasCodeElement()) {
22392        composeUriCore("code", element.getCodeElement(), false);
22393        composeUriExtras("code", element.getCodeElement(), false);
22394      }
22395      if (element.hasProfileElement()) {
22396        composeUriCore("profile", element.getProfileElement(), false);
22397        composeUriExtras("profile", element.getProfileElement(), false);
22398      }
22399      if (element.hasTargetProfileElement()) {
22400        composeUriCore("targetProfile", element.getTargetProfileElement(), false);
22401        composeUriExtras("targetProfile", element.getTargetProfileElement(), false);
22402      }
22403      if (element.hasAggregation()) {
22404        openArray("aggregation");
22405        for (Enumeration<ElementDefinition.AggregationMode> e : element.getAggregation()) 
22406          composeEnumerationCore(null, e, new ElementDefinition.AggregationModeEnumFactory(), true);
22407        closeArray();
22408        if (anyHasExtras(element.getAggregation())) {
22409          openArray("_aggregation");
22410          for (Enumeration<ElementDefinition.AggregationMode> e : element.getAggregation()) 
22411            composeEnumerationExtras(null, e, new ElementDefinition.AggregationModeEnumFactory(), true);
22412          closeArray();
22413        }
22414      };
22415      if (element.hasVersioningElement()) {
22416        composeEnumerationCore("versioning", element.getVersioningElement(), new ElementDefinition.ReferenceVersionRulesEnumFactory(), false);
22417        composeEnumerationExtras("versioning", element.getVersioningElement(), new ElementDefinition.ReferenceVersionRulesEnumFactory(), false);
22418      }
22419  }
22420
22421  protected void composeElementDefinitionElementDefinitionExampleComponent(String name, ElementDefinition.ElementDefinitionExampleComponent element) throws IOException {
22422    if (element != null) {
22423      open(name);
22424      composeElementDefinitionElementDefinitionExampleComponentInner(element);
22425      close();
22426    }
22427  }
22428
22429  protected void composeElementDefinitionElementDefinitionExampleComponentInner(ElementDefinition.ElementDefinitionExampleComponent element) throws IOException {
22430      composeElement(element);
22431      if (element.hasLabelElement()) {
22432        composeStringCore("label", element.getLabelElement(), false);
22433        composeStringExtras("label", element.getLabelElement(), false);
22434      }
22435      if (element.hasValue()) {
22436        composeType("value", element.getValue());
22437      }
22438  }
22439
22440  protected void composeElementDefinitionElementDefinitionConstraintComponent(String name, ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
22441    if (element != null) {
22442      open(name);
22443      composeElementDefinitionElementDefinitionConstraintComponentInner(element);
22444      close();
22445    }
22446  }
22447
22448  protected void composeElementDefinitionElementDefinitionConstraintComponentInner(ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
22449      composeElement(element);
22450      if (element.hasKeyElement()) {
22451        composeIdCore("key", element.getKeyElement(), false);
22452        composeIdExtras("key", element.getKeyElement(), false);
22453      }
22454      if (element.hasRequirementsElement()) {
22455        composeStringCore("requirements", element.getRequirementsElement(), false);
22456        composeStringExtras("requirements", element.getRequirementsElement(), false);
22457      }
22458      if (element.hasSeverityElement()) {
22459        composeEnumerationCore("severity", element.getSeverityElement(), new ElementDefinition.ConstraintSeverityEnumFactory(), false);
22460        composeEnumerationExtras("severity", element.getSeverityElement(), new ElementDefinition.ConstraintSeverityEnumFactory(), false);
22461      }
22462      if (element.hasHumanElement()) {
22463        composeStringCore("human", element.getHumanElement(), false);
22464        composeStringExtras("human", element.getHumanElement(), false);
22465      }
22466      if (element.hasExpressionElement()) {
22467        composeStringCore("expression", element.getExpressionElement(), false);
22468        composeStringExtras("expression", element.getExpressionElement(), false);
22469      }
22470      if (element.hasXpathElement()) {
22471        composeStringCore("xpath", element.getXpathElement(), false);
22472        composeStringExtras("xpath", element.getXpathElement(), false);
22473      }
22474      if (element.hasSourceElement()) {
22475        composeUriCore("source", element.getSourceElement(), false);
22476        composeUriExtras("source", element.getSourceElement(), false);
22477      }
22478  }
22479
22480  protected void composeElementDefinitionElementDefinitionBindingComponent(String name, ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
22481    if (element != null) {
22482      open(name);
22483      composeElementDefinitionElementDefinitionBindingComponentInner(element);
22484      close();
22485    }
22486  }
22487
22488  protected void composeElementDefinitionElementDefinitionBindingComponentInner(ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
22489      composeElement(element);
22490      if (element.hasStrengthElement()) {
22491        composeEnumerationCore("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
22492        composeEnumerationExtras("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
22493      }
22494      if (element.hasDescriptionElement()) {
22495        composeStringCore("description", element.getDescriptionElement(), false);
22496        composeStringExtras("description", element.getDescriptionElement(), false);
22497      }
22498      if (element.hasValueSet()) {
22499        composeType("valueSet", element.getValueSet());
22500      }
22501  }
22502
22503  protected void composeElementDefinitionElementDefinitionMappingComponent(String name, ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
22504    if (element != null) {
22505      open(name);
22506      composeElementDefinitionElementDefinitionMappingComponentInner(element);
22507      close();
22508    }
22509  }
22510
22511  protected void composeElementDefinitionElementDefinitionMappingComponentInner(ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
22512      composeElement(element);
22513      if (element.hasIdentityElement()) {
22514        composeIdCore("identity", element.getIdentityElement(), false);
22515        composeIdExtras("identity", element.getIdentityElement(), false);
22516      }
22517      if (element.hasLanguageElement()) {
22518        composeCodeCore("language", element.getLanguageElement(), false);
22519        composeCodeExtras("language", element.getLanguageElement(), false);
22520      }
22521      if (element.hasMapElement()) {
22522        composeStringCore("map", element.getMapElement(), false);
22523        composeStringExtras("map", element.getMapElement(), false);
22524      }
22525      if (element.hasCommentElement()) {
22526        composeStringCore("comment", element.getCommentElement(), false);
22527        composeStringExtras("comment", element.getCommentElement(), false);
22528      }
22529  }
22530
22531  protected void composeParameterDefinition(String name, ParameterDefinition element) throws IOException {
22532    if (element != null) {
22533      open(name);
22534      composeParameterDefinitionInner(element);
22535      close();
22536    }
22537  }
22538
22539  protected void composeParameterDefinitionInner(ParameterDefinition element) throws IOException {
22540      composeElement(element);
22541      if (element.hasNameElement()) {
22542        composeCodeCore("name", element.getNameElement(), false);
22543        composeCodeExtras("name", element.getNameElement(), false);
22544      }
22545      if (element.hasUseElement()) {
22546        composeEnumerationCore("use", element.getUseElement(), new ParameterDefinition.ParameterUseEnumFactory(), false);
22547        composeEnumerationExtras("use", element.getUseElement(), new ParameterDefinition.ParameterUseEnumFactory(), false);
22548      }
22549      if (element.hasMinElement()) {
22550        composeIntegerCore("min", element.getMinElement(), false);
22551        composeIntegerExtras("min", element.getMinElement(), false);
22552      }
22553      if (element.hasMaxElement()) {
22554        composeStringCore("max", element.getMaxElement(), false);
22555        composeStringExtras("max", element.getMaxElement(), false);
22556      }
22557      if (element.hasDocumentationElement()) {
22558        composeStringCore("documentation", element.getDocumentationElement(), false);
22559        composeStringExtras("documentation", element.getDocumentationElement(), false);
22560      }
22561      if (element.hasTypeElement()) {
22562        composeCodeCore("type", element.getTypeElement(), false);
22563        composeCodeExtras("type", element.getTypeElement(), false);
22564      }
22565      if (element.hasProfile()) {
22566        composeReference("profile", element.getProfile());
22567      }
22568  }
22569
22570  protected void composeDomainResourceElements(DomainResource element) throws IOException {
22571      composeResourceElements(element);
22572      if (element.hasText()) {
22573        composeNarrative("text", element.getText());
22574      }
22575      if (element.hasContained()) {
22576        openArray("contained");
22577        for (Resource e : element.getContained()) {
22578          open(null);
22579          composeResource(e);
22580          close();
22581        }
22582        closeArray();
22583      };
22584      if (element.hasExtension()) {
22585        openArray("extension");
22586        for (Extension e : element.getExtension()) 
22587          composeExtension(null, e);
22588        closeArray();
22589      };
22590      if (element.hasModifierExtension()) {
22591        openArray("modifierExtension");
22592        for (Extension e : element.getModifierExtension()) 
22593          composeExtension(null, e);
22594        closeArray();
22595      };
22596  }
22597
22598  protected void composeParameters(String name, Parameters element) throws IOException {
22599    if (element != null) {
22600      prop("resourceType", name);
22601      composeParametersInner(element);
22602    }
22603  }
22604
22605  protected void composeParametersInner(Parameters element) throws IOException {
22606      composeResourceElements(element);
22607      if (element.hasParameter()) {
22608        openArray("parameter");
22609        for (Parameters.ParametersParameterComponent e : element.getParameter()) 
22610          composeParametersParametersParameterComponent(null, e);
22611        closeArray();
22612      };
22613  }
22614
22615  protected void composeParametersParametersParameterComponent(String name, Parameters.ParametersParameterComponent element) throws IOException {
22616    if (element != null) {
22617      open(name);
22618      composeParametersParametersParameterComponentInner(element);
22619      close();
22620    }
22621  }
22622
22623  protected void composeParametersParametersParameterComponentInner(Parameters.ParametersParameterComponent element) throws IOException {
22624      composeBackbone(element);
22625      if (element.hasNameElement()) {
22626        composeStringCore("name", element.getNameElement(), false);
22627        composeStringExtras("name", element.getNameElement(), false);
22628      }
22629      if (element.hasValue()) {
22630        composeType("value", element.getValue());
22631      }
22632        if (element.hasResource()) {
22633          open("resource");
22634          composeResource(element.getResource());
22635          close();
22636        }
22637      if (element.hasPart()) {
22638        openArray("part");
22639        for (Parameters.ParametersParameterComponent e : element.getPart()) 
22640          composeParametersParametersParameterComponent(null, e);
22641        closeArray();
22642      };
22643  }
22644
22645  protected void composeResourceElements(Resource element) throws IOException {
22646      if (element.hasIdElement()) {
22647        composeIdCore("id", element.getIdElement(), false);
22648        composeIdExtras("id", element.getIdElement(), false);
22649      }
22650      if (element.hasMeta()) {
22651        composeMeta("meta", element.getMeta());
22652      }
22653      if (element.hasImplicitRulesElement()) {
22654        composeUriCore("implicitRules", element.getImplicitRulesElement(), false);
22655        composeUriExtras("implicitRules", element.getImplicitRulesElement(), false);
22656      }
22657      if (element.hasLanguageElement()) {
22658        composeCodeCore("language", element.getLanguageElement(), false);
22659        composeCodeExtras("language", element.getLanguageElement(), false);
22660      }
22661  }
22662
22663  protected void composeAccount(String name, Account element) throws IOException {
22664    if (element != null) {
22665      prop("resourceType", name);
22666      composeAccountInner(element);
22667    }
22668  }
22669
22670  protected void composeAccountInner(Account element) throws IOException {
22671      composeDomainResourceElements(element);
22672      if (element.hasIdentifier()) {
22673        openArray("identifier");
22674        for (Identifier e : element.getIdentifier()) 
22675          composeIdentifier(null, e);
22676        closeArray();
22677      };
22678      if (element.hasStatusElement()) {
22679        composeEnumerationCore("status", element.getStatusElement(), new Account.AccountStatusEnumFactory(), false);
22680        composeEnumerationExtras("status", element.getStatusElement(), new Account.AccountStatusEnumFactory(), false);
22681      }
22682      if (element.hasType()) {
22683        composeCodeableConcept("type", element.getType());
22684      }
22685      if (element.hasNameElement()) {
22686        composeStringCore("name", element.getNameElement(), false);
22687        composeStringExtras("name", element.getNameElement(), false);
22688      }
22689      if (element.hasSubject()) {
22690        composeReference("subject", element.getSubject());
22691      }
22692      if (element.hasPeriod()) {
22693        composePeriod("period", element.getPeriod());
22694      }
22695      if (element.hasActive()) {
22696        composePeriod("active", element.getActive());
22697      }
22698      if (element.hasBalance()) {
22699        composeMoney("balance", element.getBalance());
22700      }
22701      if (element.hasCoverage()) {
22702        openArray("coverage");
22703        for (Account.CoverageComponent e : element.getCoverage()) 
22704          composeAccountCoverageComponent(null, e);
22705        closeArray();
22706      };
22707      if (element.hasOwner()) {
22708        composeReference("owner", element.getOwner());
22709      }
22710      if (element.hasDescriptionElement()) {
22711        composeStringCore("description", element.getDescriptionElement(), false);
22712        composeStringExtras("description", element.getDescriptionElement(), false);
22713      }
22714      if (element.hasGuarantor()) {
22715        openArray("guarantor");
22716        for (Account.GuarantorComponent e : element.getGuarantor()) 
22717          composeAccountGuarantorComponent(null, e);
22718        closeArray();
22719      };
22720  }
22721
22722  protected void composeAccountCoverageComponent(String name, Account.CoverageComponent element) throws IOException {
22723    if (element != null) {
22724      open(name);
22725      composeAccountCoverageComponentInner(element);
22726      close();
22727    }
22728  }
22729
22730  protected void composeAccountCoverageComponentInner(Account.CoverageComponent element) throws IOException {
22731      composeBackbone(element);
22732      if (element.hasCoverage()) {
22733        composeReference("coverage", element.getCoverage());
22734      }
22735      if (element.hasPriorityElement()) {
22736        composePositiveIntCore("priority", element.getPriorityElement(), false);
22737        composePositiveIntExtras("priority", element.getPriorityElement(), false);
22738      }
22739  }
22740
22741  protected void composeAccountGuarantorComponent(String name, Account.GuarantorComponent element) throws IOException {
22742    if (element != null) {
22743      open(name);
22744      composeAccountGuarantorComponentInner(element);
22745      close();
22746    }
22747  }
22748
22749  protected void composeAccountGuarantorComponentInner(Account.GuarantorComponent element) throws IOException {
22750      composeBackbone(element);
22751      if (element.hasParty()) {
22752        composeReference("party", element.getParty());
22753      }
22754      if (element.hasOnHoldElement()) {
22755        composeBooleanCore("onHold", element.getOnHoldElement(), false);
22756        composeBooleanExtras("onHold", element.getOnHoldElement(), false);
22757      }
22758      if (element.hasPeriod()) {
22759        composePeriod("period", element.getPeriod());
22760      }
22761  }
22762
22763  protected void composeActivityDefinition(String name, ActivityDefinition element) throws IOException {
22764    if (element != null) {
22765      prop("resourceType", name);
22766      composeActivityDefinitionInner(element);
22767    }
22768  }
22769
22770  protected void composeActivityDefinitionInner(ActivityDefinition element) throws IOException {
22771      composeDomainResourceElements(element);
22772      if (element.hasUrlElement()) {
22773        composeUriCore("url", element.getUrlElement(), false);
22774        composeUriExtras("url", element.getUrlElement(), false);
22775      }
22776      if (element.hasIdentifier()) {
22777        openArray("identifier");
22778        for (Identifier e : element.getIdentifier()) 
22779          composeIdentifier(null, e);
22780        closeArray();
22781      };
22782      if (element.hasVersionElement()) {
22783        composeStringCore("version", element.getVersionElement(), false);
22784        composeStringExtras("version", element.getVersionElement(), false);
22785      }
22786      if (element.hasNameElement()) {
22787        composeStringCore("name", element.getNameElement(), false);
22788        composeStringExtras("name", element.getNameElement(), false);
22789      }
22790      if (element.hasTitleElement()) {
22791        composeStringCore("title", element.getTitleElement(), false);
22792        composeStringExtras("title", element.getTitleElement(), false);
22793      }
22794      if (element.hasStatusElement()) {
22795        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
22796        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
22797      }
22798      if (element.hasExperimentalElement()) {
22799        composeBooleanCore("experimental", element.getExperimentalElement(), false);
22800        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
22801      }
22802      if (element.hasDateElement()) {
22803        composeDateTimeCore("date", element.getDateElement(), false);
22804        composeDateTimeExtras("date", element.getDateElement(), false);
22805      }
22806      if (element.hasPublisherElement()) {
22807        composeStringCore("publisher", element.getPublisherElement(), false);
22808        composeStringExtras("publisher", element.getPublisherElement(), false);
22809      }
22810      if (element.hasDescriptionElement()) {
22811        composeMarkdownCore("description", element.getDescriptionElement(), false);
22812        composeMarkdownExtras("description", element.getDescriptionElement(), false);
22813      }
22814      if (element.hasPurposeElement()) {
22815        composeMarkdownCore("purpose", element.getPurposeElement(), false);
22816        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
22817      }
22818      if (element.hasUsageElement()) {
22819        composeStringCore("usage", element.getUsageElement(), false);
22820        composeStringExtras("usage", element.getUsageElement(), false);
22821      }
22822      if (element.hasApprovalDateElement()) {
22823        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
22824        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
22825      }
22826      if (element.hasLastReviewDateElement()) {
22827        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
22828        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
22829      }
22830      if (element.hasEffectivePeriod()) {
22831        composePeriod("effectivePeriod", element.getEffectivePeriod());
22832      }
22833      if (element.hasUseContext()) {
22834        openArray("useContext");
22835        for (UsageContext e : element.getUseContext()) 
22836          composeUsageContext(null, e);
22837        closeArray();
22838      };
22839      if (element.hasJurisdiction()) {
22840        openArray("jurisdiction");
22841        for (CodeableConcept e : element.getJurisdiction()) 
22842          composeCodeableConcept(null, e);
22843        closeArray();
22844      };
22845      if (element.hasTopic()) {
22846        openArray("topic");
22847        for (CodeableConcept e : element.getTopic()) 
22848          composeCodeableConcept(null, e);
22849        closeArray();
22850      };
22851      if (element.hasContributor()) {
22852        openArray("contributor");
22853        for (Contributor e : element.getContributor()) 
22854          composeContributor(null, e);
22855        closeArray();
22856      };
22857      if (element.hasContact()) {
22858        openArray("contact");
22859        for (ContactDetail e : element.getContact()) 
22860          composeContactDetail(null, e);
22861        closeArray();
22862      };
22863      if (element.hasCopyrightElement()) {
22864        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
22865        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
22866      }
22867      if (element.hasRelatedArtifact()) {
22868        openArray("relatedArtifact");
22869        for (RelatedArtifact e : element.getRelatedArtifact()) 
22870          composeRelatedArtifact(null, e);
22871        closeArray();
22872      };
22873      if (element.hasLibrary()) {
22874        openArray("library");
22875        for (Reference e : element.getLibrary()) 
22876          composeReference(null, e);
22877        closeArray();
22878      };
22879      if (element.hasKindElement()) {
22880        composeEnumerationCore("kind", element.getKindElement(), new ActivityDefinition.ActivityDefinitionKindEnumFactory(), false);
22881        composeEnumerationExtras("kind", element.getKindElement(), new ActivityDefinition.ActivityDefinitionKindEnumFactory(), false);
22882      }
22883      if (element.hasCode()) {
22884        composeCodeableConcept("code", element.getCode());
22885      }
22886      if (element.hasTiming()) {
22887        composeType("timing", element.getTiming());
22888      }
22889      if (element.hasLocation()) {
22890        composeReference("location", element.getLocation());
22891      }
22892      if (element.hasParticipant()) {
22893        openArray("participant");
22894        for (ActivityDefinition.ActivityDefinitionParticipantComponent e : element.getParticipant()) 
22895          composeActivityDefinitionActivityDefinitionParticipantComponent(null, e);
22896        closeArray();
22897      };
22898      if (element.hasProduct()) {
22899        composeType("product", element.getProduct());
22900      }
22901      if (element.hasQuantity()) {
22902        composeSimpleQuantity("quantity", element.getQuantity());
22903      }
22904      if (element.hasDosage()) {
22905        openArray("dosage");
22906        for (Dosage e : element.getDosage()) 
22907          composeDosage(null, e);
22908        closeArray();
22909      };
22910      if (element.hasBodySite()) {
22911        openArray("bodySite");
22912        for (CodeableConcept e : element.getBodySite()) 
22913          composeCodeableConcept(null, e);
22914        closeArray();
22915      };
22916      if (element.hasTransform()) {
22917        composeReference("transform", element.getTransform());
22918      }
22919      if (element.hasDynamicValue()) {
22920        openArray("dynamicValue");
22921        for (ActivityDefinition.ActivityDefinitionDynamicValueComponent e : element.getDynamicValue()) 
22922          composeActivityDefinitionActivityDefinitionDynamicValueComponent(null, e);
22923        closeArray();
22924      };
22925  }
22926
22927  protected void composeActivityDefinitionActivityDefinitionParticipantComponent(String name, ActivityDefinition.ActivityDefinitionParticipantComponent element) throws IOException {
22928    if (element != null) {
22929      open(name);
22930      composeActivityDefinitionActivityDefinitionParticipantComponentInner(element);
22931      close();
22932    }
22933  }
22934
22935  protected void composeActivityDefinitionActivityDefinitionParticipantComponentInner(ActivityDefinition.ActivityDefinitionParticipantComponent element) throws IOException {
22936      composeBackbone(element);
22937      if (element.hasTypeElement()) {
22938        composeEnumerationCore("type", element.getTypeElement(), new ActivityDefinition.ActivityParticipantTypeEnumFactory(), false);
22939        composeEnumerationExtras("type", element.getTypeElement(), new ActivityDefinition.ActivityParticipantTypeEnumFactory(), false);
22940      }
22941      if (element.hasRole()) {
22942        composeCodeableConcept("role", element.getRole());
22943      }
22944  }
22945
22946  protected void composeActivityDefinitionActivityDefinitionDynamicValueComponent(String name, ActivityDefinition.ActivityDefinitionDynamicValueComponent element) throws IOException {
22947    if (element != null) {
22948      open(name);
22949      composeActivityDefinitionActivityDefinitionDynamicValueComponentInner(element);
22950      close();
22951    }
22952  }
22953
22954  protected void composeActivityDefinitionActivityDefinitionDynamicValueComponentInner(ActivityDefinition.ActivityDefinitionDynamicValueComponent element) throws IOException {
22955      composeBackbone(element);
22956      if (element.hasDescriptionElement()) {
22957        composeStringCore("description", element.getDescriptionElement(), false);
22958        composeStringExtras("description", element.getDescriptionElement(), false);
22959      }
22960      if (element.hasPathElement()) {
22961        composeStringCore("path", element.getPathElement(), false);
22962        composeStringExtras("path", element.getPathElement(), false);
22963      }
22964      if (element.hasLanguageElement()) {
22965        composeStringCore("language", element.getLanguageElement(), false);
22966        composeStringExtras("language", element.getLanguageElement(), false);
22967      }
22968      if (element.hasExpressionElement()) {
22969        composeStringCore("expression", element.getExpressionElement(), false);
22970        composeStringExtras("expression", element.getExpressionElement(), false);
22971      }
22972  }
22973
22974  protected void composeAdverseEvent(String name, AdverseEvent element) throws IOException {
22975    if (element != null) {
22976      prop("resourceType", name);
22977      composeAdverseEventInner(element);
22978    }
22979  }
22980
22981  protected void composeAdverseEventInner(AdverseEvent element) throws IOException {
22982      composeDomainResourceElements(element);
22983      if (element.hasIdentifier()) {
22984        composeIdentifier("identifier", element.getIdentifier());
22985      }
22986      if (element.hasCategoryElement()) {
22987        composeEnumerationCore("category", element.getCategoryElement(), new AdverseEvent.AdverseEventCategoryEnumFactory(), false);
22988        composeEnumerationExtras("category", element.getCategoryElement(), new AdverseEvent.AdverseEventCategoryEnumFactory(), false);
22989      }
22990      if (element.hasType()) {
22991        composeCodeableConcept("type", element.getType());
22992      }
22993      if (element.hasSubject()) {
22994        composeReference("subject", element.getSubject());
22995      }
22996      if (element.hasDateElement()) {
22997        composeDateTimeCore("date", element.getDateElement(), false);
22998        composeDateTimeExtras("date", element.getDateElement(), false);
22999      }
23000      if (element.hasReaction()) {
23001        openArray("reaction");
23002        for (Reference e : element.getReaction()) 
23003          composeReference(null, e);
23004        closeArray();
23005      };
23006      if (element.hasLocation()) {
23007        composeReference("location", element.getLocation());
23008      }
23009      if (element.hasSeriousness()) {
23010        composeCodeableConcept("seriousness", element.getSeriousness());
23011      }
23012      if (element.hasOutcome()) {
23013        composeCodeableConcept("outcome", element.getOutcome());
23014      }
23015      if (element.hasRecorder()) {
23016        composeReference("recorder", element.getRecorder());
23017      }
23018      if (element.hasEventParticipant()) {
23019        composeReference("eventParticipant", element.getEventParticipant());
23020      }
23021      if (element.hasDescriptionElement()) {
23022        composeStringCore("description", element.getDescriptionElement(), false);
23023        composeStringExtras("description", element.getDescriptionElement(), false);
23024      }
23025      if (element.hasSuspectEntity()) {
23026        openArray("suspectEntity");
23027        for (AdverseEvent.AdverseEventSuspectEntityComponent e : element.getSuspectEntity()) 
23028          composeAdverseEventAdverseEventSuspectEntityComponent(null, e);
23029        closeArray();
23030      };
23031      if (element.hasSubjectMedicalHistory()) {
23032        openArray("subjectMedicalHistory");
23033        for (Reference e : element.getSubjectMedicalHistory()) 
23034          composeReference(null, e);
23035        closeArray();
23036      };
23037      if (element.hasReferenceDocument()) {
23038        openArray("referenceDocument");
23039        for (Reference e : element.getReferenceDocument()) 
23040          composeReference(null, e);
23041        closeArray();
23042      };
23043      if (element.hasStudy()) {
23044        openArray("study");
23045        for (Reference e : element.getStudy()) 
23046          composeReference(null, e);
23047        closeArray();
23048      };
23049  }
23050
23051  protected void composeAdverseEventAdverseEventSuspectEntityComponent(String name, AdverseEvent.AdverseEventSuspectEntityComponent element) throws IOException {
23052    if (element != null) {
23053      open(name);
23054      composeAdverseEventAdverseEventSuspectEntityComponentInner(element);
23055      close();
23056    }
23057  }
23058
23059  protected void composeAdverseEventAdverseEventSuspectEntityComponentInner(AdverseEvent.AdverseEventSuspectEntityComponent element) throws IOException {
23060      composeBackbone(element);
23061      if (element.hasInstance()) {
23062        composeReference("instance", element.getInstance());
23063      }
23064      if (element.hasCausalityElement()) {
23065        composeEnumerationCore("causality", element.getCausalityElement(), new AdverseEvent.AdverseEventCausalityEnumFactory(), false);
23066        composeEnumerationExtras("causality", element.getCausalityElement(), new AdverseEvent.AdverseEventCausalityEnumFactory(), false);
23067      }
23068      if (element.hasCausalityAssessment()) {
23069        composeCodeableConcept("causalityAssessment", element.getCausalityAssessment());
23070      }
23071      if (element.hasCausalityProductRelatednessElement()) {
23072        composeStringCore("causalityProductRelatedness", element.getCausalityProductRelatednessElement(), false);
23073        composeStringExtras("causalityProductRelatedness", element.getCausalityProductRelatednessElement(), false);
23074      }
23075      if (element.hasCausalityMethod()) {
23076        composeCodeableConcept("causalityMethod", element.getCausalityMethod());
23077      }
23078      if (element.hasCausalityAuthor()) {
23079        composeReference("causalityAuthor", element.getCausalityAuthor());
23080      }
23081      if (element.hasCausalityResult()) {
23082        composeCodeableConcept("causalityResult", element.getCausalityResult());
23083      }
23084  }
23085
23086  protected void composeAllergyIntolerance(String name, AllergyIntolerance element) throws IOException {
23087    if (element != null) {
23088      prop("resourceType", name);
23089      composeAllergyIntoleranceInner(element);
23090    }
23091  }
23092
23093  protected void composeAllergyIntoleranceInner(AllergyIntolerance element) throws IOException {
23094      composeDomainResourceElements(element);
23095      if (element.hasIdentifier()) {
23096        openArray("identifier");
23097        for (Identifier e : element.getIdentifier()) 
23098          composeIdentifier(null, e);
23099        closeArray();
23100      };
23101      if (element.hasClinicalStatusElement()) {
23102        composeEnumerationCore("clinicalStatus", element.getClinicalStatusElement(), new AllergyIntolerance.AllergyIntoleranceClinicalStatusEnumFactory(), false);
23103        composeEnumerationExtras("clinicalStatus", element.getClinicalStatusElement(), new AllergyIntolerance.AllergyIntoleranceClinicalStatusEnumFactory(), false);
23104      }
23105      if (element.hasVerificationStatusElement()) {
23106        composeEnumerationCore("verificationStatus", element.getVerificationStatusElement(), new AllergyIntolerance.AllergyIntoleranceVerificationStatusEnumFactory(), false);
23107        composeEnumerationExtras("verificationStatus", element.getVerificationStatusElement(), new AllergyIntolerance.AllergyIntoleranceVerificationStatusEnumFactory(), false);
23108      }
23109      if (element.hasTypeElement()) {
23110        composeEnumerationCore("type", element.getTypeElement(), new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory(), false);
23111        composeEnumerationExtras("type", element.getTypeElement(), new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory(), false);
23112      }
23113      if (element.hasCategory()) {
23114        openArray("category");
23115        for (Enumeration<AllergyIntolerance.AllergyIntoleranceCategory> e : element.getCategory()) 
23116          composeEnumerationCore(null, e, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), true);
23117        closeArray();
23118        if (anyHasExtras(element.getCategory())) {
23119          openArray("_category");
23120          for (Enumeration<AllergyIntolerance.AllergyIntoleranceCategory> e : element.getCategory()) 
23121            composeEnumerationExtras(null, e, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), true);
23122          closeArray();
23123        }
23124      };
23125      if (element.hasCriticalityElement()) {
23126        composeEnumerationCore("criticality", element.getCriticalityElement(), new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory(), false);
23127        composeEnumerationExtras("criticality", element.getCriticalityElement(), new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory(), false);
23128      }
23129      if (element.hasCode()) {
23130        composeCodeableConcept("code", element.getCode());
23131      }
23132      if (element.hasPatient()) {
23133        composeReference("patient", element.getPatient());
23134      }
23135      if (element.hasOnset()) {
23136        composeType("onset", element.getOnset());
23137      }
23138      if (element.hasAssertedDateElement()) {
23139        composeDateTimeCore("assertedDate", element.getAssertedDateElement(), false);
23140        composeDateTimeExtras("assertedDate", element.getAssertedDateElement(), false);
23141      }
23142      if (element.hasRecorder()) {
23143        composeReference("recorder", element.getRecorder());
23144      }
23145      if (element.hasAsserter()) {
23146        composeReference("asserter", element.getAsserter());
23147      }
23148      if (element.hasLastOccurrenceElement()) {
23149        composeDateTimeCore("lastOccurrence", element.getLastOccurrenceElement(), false);
23150        composeDateTimeExtras("lastOccurrence", element.getLastOccurrenceElement(), false);
23151      }
23152      if (element.hasNote()) {
23153        openArray("note");
23154        for (Annotation e : element.getNote()) 
23155          composeAnnotation(null, e);
23156        closeArray();
23157      };
23158      if (element.hasReaction()) {
23159        openArray("reaction");
23160        for (AllergyIntolerance.AllergyIntoleranceReactionComponent e : element.getReaction()) 
23161          composeAllergyIntoleranceAllergyIntoleranceReactionComponent(null, e);
23162        closeArray();
23163      };
23164  }
23165
23166  protected void composeAllergyIntoleranceAllergyIntoleranceReactionComponent(String name, AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
23167    if (element != null) {
23168      open(name);
23169      composeAllergyIntoleranceAllergyIntoleranceReactionComponentInner(element);
23170      close();
23171    }
23172  }
23173
23174  protected void composeAllergyIntoleranceAllergyIntoleranceReactionComponentInner(AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
23175      composeBackbone(element);
23176      if (element.hasSubstance()) {
23177        composeCodeableConcept("substance", element.getSubstance());
23178      }
23179      if (element.hasManifestation()) {
23180        openArray("manifestation");
23181        for (CodeableConcept e : element.getManifestation()) 
23182          composeCodeableConcept(null, e);
23183        closeArray();
23184      };
23185      if (element.hasDescriptionElement()) {
23186        composeStringCore("description", element.getDescriptionElement(), false);
23187        composeStringExtras("description", element.getDescriptionElement(), false);
23188      }
23189      if (element.hasOnsetElement()) {
23190        composeDateTimeCore("onset", element.getOnsetElement(), false);
23191        composeDateTimeExtras("onset", element.getOnsetElement(), false);
23192      }
23193      if (element.hasSeverityElement()) {
23194        composeEnumerationCore("severity", element.getSeverityElement(), new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory(), false);
23195        composeEnumerationExtras("severity", element.getSeverityElement(), new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory(), false);
23196      }
23197      if (element.hasExposureRoute()) {
23198        composeCodeableConcept("exposureRoute", element.getExposureRoute());
23199      }
23200      if (element.hasNote()) {
23201        openArray("note");
23202        for (Annotation e : element.getNote()) 
23203          composeAnnotation(null, e);
23204        closeArray();
23205      };
23206  }
23207
23208  protected void composeAppointment(String name, Appointment element) throws IOException {
23209    if (element != null) {
23210      prop("resourceType", name);
23211      composeAppointmentInner(element);
23212    }
23213  }
23214
23215  protected void composeAppointmentInner(Appointment element) throws IOException {
23216      composeDomainResourceElements(element);
23217      if (element.hasIdentifier()) {
23218        openArray("identifier");
23219        for (Identifier e : element.getIdentifier()) 
23220          composeIdentifier(null, e);
23221        closeArray();
23222      };
23223      if (element.hasStatusElement()) {
23224        composeEnumerationCore("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory(), false);
23225        composeEnumerationExtras("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory(), false);
23226      }
23227      if (element.hasServiceCategory()) {
23228        composeCodeableConcept("serviceCategory", element.getServiceCategory());
23229      }
23230      if (element.hasServiceType()) {
23231        openArray("serviceType");
23232        for (CodeableConcept e : element.getServiceType()) 
23233          composeCodeableConcept(null, e);
23234        closeArray();
23235      };
23236      if (element.hasSpecialty()) {
23237        openArray("specialty");
23238        for (CodeableConcept e : element.getSpecialty()) 
23239          composeCodeableConcept(null, e);
23240        closeArray();
23241      };
23242      if (element.hasAppointmentType()) {
23243        composeCodeableConcept("appointmentType", element.getAppointmentType());
23244      }
23245      if (element.hasReason()) {
23246        openArray("reason");
23247        for (CodeableConcept e : element.getReason()) 
23248          composeCodeableConcept(null, e);
23249        closeArray();
23250      };
23251      if (element.hasIndication()) {
23252        openArray("indication");
23253        for (Reference e : element.getIndication()) 
23254          composeReference(null, e);
23255        closeArray();
23256      };
23257      if (element.hasPriorityElement()) {
23258        composeUnsignedIntCore("priority", element.getPriorityElement(), false);
23259        composeUnsignedIntExtras("priority", element.getPriorityElement(), false);
23260      }
23261      if (element.hasDescriptionElement()) {
23262        composeStringCore("description", element.getDescriptionElement(), false);
23263        composeStringExtras("description", element.getDescriptionElement(), false);
23264      }
23265      if (element.hasSupportingInformation()) {
23266        openArray("supportingInformation");
23267        for (Reference e : element.getSupportingInformation()) 
23268          composeReference(null, e);
23269        closeArray();
23270      };
23271      if (element.hasStartElement()) {
23272        composeInstantCore("start", element.getStartElement(), false);
23273        composeInstantExtras("start", element.getStartElement(), false);
23274      }
23275      if (element.hasEndElement()) {
23276        composeInstantCore("end", element.getEndElement(), false);
23277        composeInstantExtras("end", element.getEndElement(), false);
23278      }
23279      if (element.hasMinutesDurationElement()) {
23280        composePositiveIntCore("minutesDuration", element.getMinutesDurationElement(), false);
23281        composePositiveIntExtras("minutesDuration", element.getMinutesDurationElement(), false);
23282      }
23283      if (element.hasSlot()) {
23284        openArray("slot");
23285        for (Reference e : element.getSlot()) 
23286          composeReference(null, e);
23287        closeArray();
23288      };
23289      if (element.hasCreatedElement()) {
23290        composeDateTimeCore("created", element.getCreatedElement(), false);
23291        composeDateTimeExtras("created", element.getCreatedElement(), false);
23292      }
23293      if (element.hasCommentElement()) {
23294        composeStringCore("comment", element.getCommentElement(), false);
23295        composeStringExtras("comment", element.getCommentElement(), false);
23296      }
23297      if (element.hasIncomingReferral()) {
23298        openArray("incomingReferral");
23299        for (Reference e : element.getIncomingReferral()) 
23300          composeReference(null, e);
23301        closeArray();
23302      };
23303      if (element.hasParticipant()) {
23304        openArray("participant");
23305        for (Appointment.AppointmentParticipantComponent e : element.getParticipant()) 
23306          composeAppointmentAppointmentParticipantComponent(null, e);
23307        closeArray();
23308      };
23309      if (element.hasRequestedPeriod()) {
23310        openArray("requestedPeriod");
23311        for (Period e : element.getRequestedPeriod()) 
23312          composePeriod(null, e);
23313        closeArray();
23314      };
23315  }
23316
23317  protected void composeAppointmentAppointmentParticipantComponent(String name, Appointment.AppointmentParticipantComponent element) throws IOException {
23318    if (element != null) {
23319      open(name);
23320      composeAppointmentAppointmentParticipantComponentInner(element);
23321      close();
23322    }
23323  }
23324
23325  protected void composeAppointmentAppointmentParticipantComponentInner(Appointment.AppointmentParticipantComponent element) throws IOException {
23326      composeBackbone(element);
23327      if (element.hasType()) {
23328        openArray("type");
23329        for (CodeableConcept e : element.getType()) 
23330          composeCodeableConcept(null, e);
23331        closeArray();
23332      };
23333      if (element.hasActor()) {
23334        composeReference("actor", element.getActor());
23335      }
23336      if (element.hasRequiredElement()) {
23337        composeEnumerationCore("required", element.getRequiredElement(), new Appointment.ParticipantRequiredEnumFactory(), false);
23338        composeEnumerationExtras("required", element.getRequiredElement(), new Appointment.ParticipantRequiredEnumFactory(), false);
23339      }
23340      if (element.hasStatusElement()) {
23341        composeEnumerationCore("status", element.getStatusElement(), new Appointment.ParticipationStatusEnumFactory(), false);
23342        composeEnumerationExtras("status", element.getStatusElement(), new Appointment.ParticipationStatusEnumFactory(), false);
23343      }
23344  }
23345
23346  protected void composeAppointmentResponse(String name, AppointmentResponse element) throws IOException {
23347    if (element != null) {
23348      prop("resourceType", name);
23349      composeAppointmentResponseInner(element);
23350    }
23351  }
23352
23353  protected void composeAppointmentResponseInner(AppointmentResponse element) throws IOException {
23354      composeDomainResourceElements(element);
23355      if (element.hasIdentifier()) {
23356        openArray("identifier");
23357        for (Identifier e : element.getIdentifier()) 
23358          composeIdentifier(null, e);
23359        closeArray();
23360      };
23361      if (element.hasAppointment()) {
23362        composeReference("appointment", element.getAppointment());
23363      }
23364      if (element.hasStartElement()) {
23365        composeInstantCore("start", element.getStartElement(), false);
23366        composeInstantExtras("start", element.getStartElement(), false);
23367      }
23368      if (element.hasEndElement()) {
23369        composeInstantCore("end", element.getEndElement(), false);
23370        composeInstantExtras("end", element.getEndElement(), false);
23371      }
23372      if (element.hasParticipantType()) {
23373        openArray("participantType");
23374        for (CodeableConcept e : element.getParticipantType()) 
23375          composeCodeableConcept(null, e);
23376        closeArray();
23377      };
23378      if (element.hasActor()) {
23379        composeReference("actor", element.getActor());
23380      }
23381      if (element.hasParticipantStatusElement()) {
23382        composeEnumerationCore("participantStatus", element.getParticipantStatusElement(), new AppointmentResponse.ParticipantStatusEnumFactory(), false);
23383        composeEnumerationExtras("participantStatus", element.getParticipantStatusElement(), new AppointmentResponse.ParticipantStatusEnumFactory(), false);
23384      }
23385      if (element.hasCommentElement()) {
23386        composeStringCore("comment", element.getCommentElement(), false);
23387        composeStringExtras("comment", element.getCommentElement(), false);
23388      }
23389  }
23390
23391  protected void composeAuditEvent(String name, AuditEvent element) throws IOException {
23392    if (element != null) {
23393      prop("resourceType", name);
23394      composeAuditEventInner(element);
23395    }
23396  }
23397
23398  protected void composeAuditEventInner(AuditEvent element) throws IOException {
23399      composeDomainResourceElements(element);
23400      if (element.hasType()) {
23401        composeCoding("type", element.getType());
23402      }
23403      if (element.hasSubtype()) {
23404        openArray("subtype");
23405        for (Coding e : element.getSubtype()) 
23406          composeCoding(null, e);
23407        closeArray();
23408      };
23409      if (element.hasActionElement()) {
23410        composeEnumerationCore("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory(), false);
23411        composeEnumerationExtras("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory(), false);
23412      }
23413      if (element.hasRecordedElement()) {
23414        composeInstantCore("recorded", element.getRecordedElement(), false);
23415        composeInstantExtras("recorded", element.getRecordedElement(), false);
23416      }
23417      if (element.hasOutcomeElement()) {
23418        composeEnumerationCore("outcome", element.getOutcomeElement(), new AuditEvent.AuditEventOutcomeEnumFactory(), false);
23419        composeEnumerationExtras("outcome", element.getOutcomeElement(), new AuditEvent.AuditEventOutcomeEnumFactory(), false);
23420      }
23421      if (element.hasOutcomeDescElement()) {
23422        composeStringCore("outcomeDesc", element.getOutcomeDescElement(), false);
23423        composeStringExtras("outcomeDesc", element.getOutcomeDescElement(), false);
23424      }
23425      if (element.hasPurposeOfEvent()) {
23426        openArray("purposeOfEvent");
23427        for (CodeableConcept e : element.getPurposeOfEvent()) 
23428          composeCodeableConcept(null, e);
23429        closeArray();
23430      };
23431      if (element.hasAgent()) {
23432        openArray("agent");
23433        for (AuditEvent.AuditEventAgentComponent e : element.getAgent()) 
23434          composeAuditEventAuditEventAgentComponent(null, e);
23435        closeArray();
23436      };
23437      if (element.hasSource()) {
23438        composeAuditEventAuditEventSourceComponent("source", element.getSource());
23439      }
23440      if (element.hasEntity()) {
23441        openArray("entity");
23442        for (AuditEvent.AuditEventEntityComponent e : element.getEntity()) 
23443          composeAuditEventAuditEventEntityComponent(null, e);
23444        closeArray();
23445      };
23446  }
23447
23448  protected void composeAuditEventAuditEventAgentComponent(String name, AuditEvent.AuditEventAgentComponent element) throws IOException {
23449    if (element != null) {
23450      open(name);
23451      composeAuditEventAuditEventAgentComponentInner(element);
23452      close();
23453    }
23454  }
23455
23456  protected void composeAuditEventAuditEventAgentComponentInner(AuditEvent.AuditEventAgentComponent element) throws IOException {
23457      composeBackbone(element);
23458      if (element.hasRole()) {
23459        openArray("role");
23460        for (CodeableConcept e : element.getRole()) 
23461          composeCodeableConcept(null, e);
23462        closeArray();
23463      };
23464      if (element.hasReference()) {
23465        composeReference("reference", element.getReference());
23466      }
23467      if (element.hasUserId()) {
23468        composeIdentifier("userId", element.getUserId());
23469      }
23470      if (element.hasAltIdElement()) {
23471        composeStringCore("altId", element.getAltIdElement(), false);
23472        composeStringExtras("altId", element.getAltIdElement(), false);
23473      }
23474      if (element.hasNameElement()) {
23475        composeStringCore("name", element.getNameElement(), false);
23476        composeStringExtras("name", element.getNameElement(), false);
23477      }
23478      if (element.hasRequestorElement()) {
23479        composeBooleanCore("requestor", element.getRequestorElement(), false);
23480        composeBooleanExtras("requestor", element.getRequestorElement(), false);
23481      }
23482      if (element.hasLocation()) {
23483        composeReference("location", element.getLocation());
23484      }
23485      if (element.hasPolicy()) {
23486        openArray("policy");
23487        for (UriType e : element.getPolicy()) 
23488          composeUriCore(null, e, true);
23489        closeArray();
23490        if (anyHasExtras(element.getPolicy())) {
23491          openArray("_policy");
23492          for (UriType e : element.getPolicy()) 
23493            composeUriExtras(null, e, true);
23494          closeArray();
23495        }
23496      };
23497      if (element.hasMedia()) {
23498        composeCoding("media", element.getMedia());
23499      }
23500      if (element.hasNetwork()) {
23501        composeAuditEventAuditEventAgentNetworkComponent("network", element.getNetwork());
23502      }
23503      if (element.hasPurposeOfUse()) {
23504        openArray("purposeOfUse");
23505        for (CodeableConcept e : element.getPurposeOfUse()) 
23506          composeCodeableConcept(null, e);
23507        closeArray();
23508      };
23509  }
23510
23511  protected void composeAuditEventAuditEventAgentNetworkComponent(String name, AuditEvent.AuditEventAgentNetworkComponent element) throws IOException {
23512    if (element != null) {
23513      open(name);
23514      composeAuditEventAuditEventAgentNetworkComponentInner(element);
23515      close();
23516    }
23517  }
23518
23519  protected void composeAuditEventAuditEventAgentNetworkComponentInner(AuditEvent.AuditEventAgentNetworkComponent element) throws IOException {
23520      composeBackbone(element);
23521      if (element.hasAddressElement()) {
23522        composeStringCore("address", element.getAddressElement(), false);
23523        composeStringExtras("address", element.getAddressElement(), false);
23524      }
23525      if (element.hasTypeElement()) {
23526        composeEnumerationCore("type", element.getTypeElement(), new AuditEvent.AuditEventAgentNetworkTypeEnumFactory(), false);
23527        composeEnumerationExtras("type", element.getTypeElement(), new AuditEvent.AuditEventAgentNetworkTypeEnumFactory(), false);
23528      }
23529  }
23530
23531  protected void composeAuditEventAuditEventSourceComponent(String name, AuditEvent.AuditEventSourceComponent element) throws IOException {
23532    if (element != null) {
23533      open(name);
23534      composeAuditEventAuditEventSourceComponentInner(element);
23535      close();
23536    }
23537  }
23538
23539  protected void composeAuditEventAuditEventSourceComponentInner(AuditEvent.AuditEventSourceComponent element) throws IOException {
23540      composeBackbone(element);
23541      if (element.hasSiteElement()) {
23542        composeStringCore("site", element.getSiteElement(), false);
23543        composeStringExtras("site", element.getSiteElement(), false);
23544      }
23545      if (element.hasIdentifier()) {
23546        composeIdentifier("identifier", element.getIdentifier());
23547      }
23548      if (element.hasType()) {
23549        openArray("type");
23550        for (Coding e : element.getType()) 
23551          composeCoding(null, e);
23552        closeArray();
23553      };
23554  }
23555
23556  protected void composeAuditEventAuditEventEntityComponent(String name, AuditEvent.AuditEventEntityComponent element) throws IOException {
23557    if (element != null) {
23558      open(name);
23559      composeAuditEventAuditEventEntityComponentInner(element);
23560      close();
23561    }
23562  }
23563
23564  protected void composeAuditEventAuditEventEntityComponentInner(AuditEvent.AuditEventEntityComponent element) throws IOException {
23565      composeBackbone(element);
23566      if (element.hasIdentifier()) {
23567        composeIdentifier("identifier", element.getIdentifier());
23568      }
23569      if (element.hasReference()) {
23570        composeReference("reference", element.getReference());
23571      }
23572      if (element.hasType()) {
23573        composeCoding("type", element.getType());
23574      }
23575      if (element.hasRole()) {
23576        composeCoding("role", element.getRole());
23577      }
23578      if (element.hasLifecycle()) {
23579        composeCoding("lifecycle", element.getLifecycle());
23580      }
23581      if (element.hasSecurityLabel()) {
23582        openArray("securityLabel");
23583        for (Coding e : element.getSecurityLabel()) 
23584          composeCoding(null, e);
23585        closeArray();
23586      };
23587      if (element.hasNameElement()) {
23588        composeStringCore("name", element.getNameElement(), false);
23589        composeStringExtras("name", element.getNameElement(), false);
23590      }
23591      if (element.hasDescriptionElement()) {
23592        composeStringCore("description", element.getDescriptionElement(), false);
23593        composeStringExtras("description", element.getDescriptionElement(), false);
23594      }
23595      if (element.hasQueryElement()) {
23596        composeBase64BinaryCore("query", element.getQueryElement(), false);
23597        composeBase64BinaryExtras("query", element.getQueryElement(), false);
23598      }
23599      if (element.hasDetail()) {
23600        openArray("detail");
23601        for (AuditEvent.AuditEventEntityDetailComponent e : element.getDetail()) 
23602          composeAuditEventAuditEventEntityDetailComponent(null, e);
23603        closeArray();
23604      };
23605  }
23606
23607  protected void composeAuditEventAuditEventEntityDetailComponent(String name, AuditEvent.AuditEventEntityDetailComponent element) throws IOException {
23608    if (element != null) {
23609      open(name);
23610      composeAuditEventAuditEventEntityDetailComponentInner(element);
23611      close();
23612    }
23613  }
23614
23615  protected void composeAuditEventAuditEventEntityDetailComponentInner(AuditEvent.AuditEventEntityDetailComponent element) throws IOException {
23616      composeBackbone(element);
23617      if (element.hasTypeElement()) {
23618        composeStringCore("type", element.getTypeElement(), false);
23619        composeStringExtras("type", element.getTypeElement(), false);
23620      }
23621      if (element.hasValueElement()) {
23622        composeBase64BinaryCore("value", element.getValueElement(), false);
23623        composeBase64BinaryExtras("value", element.getValueElement(), false);
23624      }
23625  }
23626
23627  protected void composeBasic(String name, Basic element) throws IOException {
23628    if (element != null) {
23629      prop("resourceType", name);
23630      composeBasicInner(element);
23631    }
23632  }
23633
23634  protected void composeBasicInner(Basic element) throws IOException {
23635      composeDomainResourceElements(element);
23636      if (element.hasIdentifier()) {
23637        openArray("identifier");
23638        for (Identifier e : element.getIdentifier()) 
23639          composeIdentifier(null, e);
23640        closeArray();
23641      };
23642      if (element.hasCode()) {
23643        composeCodeableConcept("code", element.getCode());
23644      }
23645      if (element.hasSubject()) {
23646        composeReference("subject", element.getSubject());
23647      }
23648      if (element.hasCreatedElement()) {
23649        composeDateCore("created", element.getCreatedElement(), false);
23650        composeDateExtras("created", element.getCreatedElement(), false);
23651      }
23652      if (element.hasAuthor()) {
23653        composeReference("author", element.getAuthor());
23654      }
23655  }
23656
23657  protected void composeBinary(String name, Binary element) throws IOException {
23658    if (element != null) {
23659      prop("resourceType", name);
23660      composeBinaryInner(element);
23661    }
23662  }
23663
23664  protected void composeBinaryInner(Binary element) throws IOException {
23665      composeResourceElements(element);
23666      if (element.hasContentTypeElement()) {
23667        composeCodeCore("contentType", element.getContentTypeElement(), false);
23668        composeCodeExtras("contentType", element.getContentTypeElement(), false);
23669      }
23670      if (element.hasSecurityContext()) {
23671        composeReference("securityContext", element.getSecurityContext());
23672      }
23673      if (element.hasContentElement()) {
23674        composeBase64BinaryCore("content", element.getContentElement(), false);
23675        composeBase64BinaryExtras("content", element.getContentElement(), false);
23676      }
23677  }
23678
23679  protected void composeBodySite(String name, BodySite element) throws IOException {
23680    if (element != null) {
23681      prop("resourceType", name);
23682      composeBodySiteInner(element);
23683    }
23684  }
23685
23686  protected void composeBodySiteInner(BodySite element) throws IOException {
23687      composeDomainResourceElements(element);
23688      if (element.hasIdentifier()) {
23689        openArray("identifier");
23690        for (Identifier e : element.getIdentifier()) 
23691          composeIdentifier(null, e);
23692        closeArray();
23693      };
23694      if (element.hasActiveElement()) {
23695        composeBooleanCore("active", element.getActiveElement(), false);
23696        composeBooleanExtras("active", element.getActiveElement(), false);
23697      }
23698      if (element.hasCode()) {
23699        composeCodeableConcept("code", element.getCode());
23700      }
23701      if (element.hasQualifier()) {
23702        openArray("qualifier");
23703        for (CodeableConcept e : element.getQualifier()) 
23704          composeCodeableConcept(null, e);
23705        closeArray();
23706      };
23707      if (element.hasDescriptionElement()) {
23708        composeStringCore("description", element.getDescriptionElement(), false);
23709        composeStringExtras("description", element.getDescriptionElement(), false);
23710      }
23711      if (element.hasImage()) {
23712        openArray("image");
23713        for (Attachment e : element.getImage()) 
23714          composeAttachment(null, e);
23715        closeArray();
23716      };
23717      if (element.hasPatient()) {
23718        composeReference("patient", element.getPatient());
23719      }
23720  }
23721
23722  protected void composeBundle(String name, Bundle element) throws IOException {
23723    if (element != null) {
23724      prop("resourceType", name);
23725      composeBundleInner(element);
23726    }
23727  }
23728
23729  protected void composeBundleInner(Bundle element) throws IOException {
23730      composeResourceElements(element);
23731      if (element.hasIdentifier()) {
23732        composeIdentifier("identifier", element.getIdentifier());
23733      }
23734      if (element.hasTypeElement()) {
23735        composeEnumerationCore("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory(), false);
23736        composeEnumerationExtras("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory(), false);
23737      }
23738      if (element.hasTotalElement()) {
23739        composeUnsignedIntCore("total", element.getTotalElement(), false);
23740        composeUnsignedIntExtras("total", element.getTotalElement(), false);
23741      }
23742      if (element.hasLink()) {
23743        openArray("link");
23744        for (Bundle.BundleLinkComponent e : element.getLink()) 
23745          composeBundleBundleLinkComponent(null, e);
23746        closeArray();
23747      };
23748      if (element.hasEntry()) {
23749        openArray("entry");
23750        for (Bundle.BundleEntryComponent e : element.getEntry()) 
23751          composeBundleBundleEntryComponent(null, e);
23752        closeArray();
23753      };
23754      if (element.hasSignature()) {
23755        composeSignature("signature", element.getSignature());
23756      }
23757  }
23758
23759  protected void composeBundleBundleLinkComponent(String name, Bundle.BundleLinkComponent element) throws IOException {
23760    if (element != null) {
23761      open(name);
23762      composeBundleBundleLinkComponentInner(element);
23763      close();
23764    }
23765  }
23766
23767  protected void composeBundleBundleLinkComponentInner(Bundle.BundleLinkComponent element) throws IOException {
23768      composeBackbone(element);
23769      if (element.hasRelationElement()) {
23770        composeStringCore("relation", element.getRelationElement(), false);
23771        composeStringExtras("relation", element.getRelationElement(), false);
23772      }
23773      if (element.hasUrlElement()) {
23774        composeUriCore("url", element.getUrlElement(), false);
23775        composeUriExtras("url", element.getUrlElement(), false);
23776      }
23777  }
23778
23779  protected void composeBundleBundleEntryComponent(String name, Bundle.BundleEntryComponent element) throws IOException {
23780    if (element != null) {
23781      open(name);
23782      composeBundleBundleEntryComponentInner(element);
23783      close();
23784    }
23785  }
23786
23787  protected void composeBundleBundleEntryComponentInner(Bundle.BundleEntryComponent element) throws IOException {
23788      composeBackbone(element);
23789      if (element.hasLink()) {
23790        openArray("link");
23791        for (Bundle.BundleLinkComponent e : element.getLink()) 
23792          composeBundleBundleLinkComponent(null, e);
23793        closeArray();
23794      };
23795      if (element.hasFullUrlElement()) {
23796        composeUriCore("fullUrl", element.getFullUrlElement(), false);
23797        composeUriExtras("fullUrl", element.getFullUrlElement(), false);
23798      }
23799        if (element.hasResource()) {
23800          open("resource");
23801          composeResource(element.getResource());
23802          close();
23803        }
23804      if (element.hasSearch()) {
23805        composeBundleBundleEntrySearchComponent("search", element.getSearch());
23806      }
23807      if (element.hasRequest()) {
23808        composeBundleBundleEntryRequestComponent("request", element.getRequest());
23809      }
23810      if (element.hasResponse()) {
23811        composeBundleBundleEntryResponseComponent("response", element.getResponse());
23812      }
23813  }
23814
23815  protected void composeBundleBundleEntrySearchComponent(String name, Bundle.BundleEntrySearchComponent element) throws IOException {
23816    if (element != null) {
23817      open(name);
23818      composeBundleBundleEntrySearchComponentInner(element);
23819      close();
23820    }
23821  }
23822
23823  protected void composeBundleBundleEntrySearchComponentInner(Bundle.BundleEntrySearchComponent element) throws IOException {
23824      composeBackbone(element);
23825      if (element.hasModeElement()) {
23826        composeEnumerationCore("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory(), false);
23827        composeEnumerationExtras("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory(), false);
23828      }
23829      if (element.hasScoreElement()) {
23830        composeDecimalCore("score", element.getScoreElement(), false);
23831        composeDecimalExtras("score", element.getScoreElement(), false);
23832      }
23833  }
23834
23835  protected void composeBundleBundleEntryRequestComponent(String name, Bundle.BundleEntryRequestComponent element) throws IOException {
23836    if (element != null) {
23837      open(name);
23838      composeBundleBundleEntryRequestComponentInner(element);
23839      close();
23840    }
23841  }
23842
23843  protected void composeBundleBundleEntryRequestComponentInner(Bundle.BundleEntryRequestComponent element) throws IOException {
23844      composeBackbone(element);
23845      if (element.hasMethodElement()) {
23846        composeEnumerationCore("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory(), false);
23847        composeEnumerationExtras("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory(), false);
23848      }
23849      if (element.hasUrlElement()) {
23850        composeUriCore("url", element.getUrlElement(), false);
23851        composeUriExtras("url", element.getUrlElement(), false);
23852      }
23853      if (element.hasIfNoneMatchElement()) {
23854        composeStringCore("ifNoneMatch", element.getIfNoneMatchElement(), false);
23855        composeStringExtras("ifNoneMatch", element.getIfNoneMatchElement(), false);
23856      }
23857      if (element.hasIfModifiedSinceElement()) {
23858        composeInstantCore("ifModifiedSince", element.getIfModifiedSinceElement(), false);
23859        composeInstantExtras("ifModifiedSince", element.getIfModifiedSinceElement(), false);
23860      }
23861      if (element.hasIfMatchElement()) {
23862        composeStringCore("ifMatch", element.getIfMatchElement(), false);
23863        composeStringExtras("ifMatch", element.getIfMatchElement(), false);
23864      }
23865      if (element.hasIfNoneExistElement()) {
23866        composeStringCore("ifNoneExist", element.getIfNoneExistElement(), false);
23867        composeStringExtras("ifNoneExist", element.getIfNoneExistElement(), false);
23868      }
23869  }
23870
23871  protected void composeBundleBundleEntryResponseComponent(String name, Bundle.BundleEntryResponseComponent element) throws IOException {
23872    if (element != null) {
23873      open(name);
23874      composeBundleBundleEntryResponseComponentInner(element);
23875      close();
23876    }
23877  }
23878
23879  protected void composeBundleBundleEntryResponseComponentInner(Bundle.BundleEntryResponseComponent element) throws IOException {
23880      composeBackbone(element);
23881      if (element.hasStatusElement()) {
23882        composeStringCore("status", element.getStatusElement(), false);
23883        composeStringExtras("status", element.getStatusElement(), false);
23884      }
23885      if (element.hasLocationElement()) {
23886        composeUriCore("location", element.getLocationElement(), false);
23887        composeUriExtras("location", element.getLocationElement(), false);
23888      }
23889      if (element.hasEtagElement()) {
23890        composeStringCore("etag", element.getEtagElement(), false);
23891        composeStringExtras("etag", element.getEtagElement(), false);
23892      }
23893      if (element.hasLastModifiedElement()) {
23894        composeInstantCore("lastModified", element.getLastModifiedElement(), false);
23895        composeInstantExtras("lastModified", element.getLastModifiedElement(), false);
23896      }
23897        if (element.hasOutcome()) {
23898          open("outcome");
23899          composeResource(element.getOutcome());
23900          close();
23901        }
23902  }
23903
23904  protected void composeCapabilityStatement(String name, CapabilityStatement element) throws IOException {
23905    if (element != null) {
23906      prop("resourceType", name);
23907      composeCapabilityStatementInner(element);
23908    }
23909  }
23910
23911  protected void composeCapabilityStatementInner(CapabilityStatement element) throws IOException {
23912      composeDomainResourceElements(element);
23913      if (element.hasUrlElement()) {
23914        composeUriCore("url", element.getUrlElement(), false);
23915        composeUriExtras("url", element.getUrlElement(), false);
23916      }
23917      if (element.hasVersionElement()) {
23918        composeStringCore("version", element.getVersionElement(), false);
23919        composeStringExtras("version", element.getVersionElement(), false);
23920      }
23921      if (element.hasNameElement()) {
23922        composeStringCore("name", element.getNameElement(), false);
23923        composeStringExtras("name", element.getNameElement(), false);
23924      }
23925      if (element.hasTitleElement()) {
23926        composeStringCore("title", element.getTitleElement(), false);
23927        composeStringExtras("title", element.getTitleElement(), false);
23928      }
23929      if (element.hasStatusElement()) {
23930        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
23931        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
23932      }
23933      if (element.hasExperimentalElement()) {
23934        composeBooleanCore("experimental", element.getExperimentalElement(), false);
23935        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
23936      }
23937      if (element.hasDateElement()) {
23938        composeDateTimeCore("date", element.getDateElement(), false);
23939        composeDateTimeExtras("date", element.getDateElement(), false);
23940      }
23941      if (element.hasPublisherElement()) {
23942        composeStringCore("publisher", element.getPublisherElement(), false);
23943        composeStringExtras("publisher", element.getPublisherElement(), false);
23944      }
23945      if (element.hasContact()) {
23946        openArray("contact");
23947        for (ContactDetail e : element.getContact()) 
23948          composeContactDetail(null, e);
23949        closeArray();
23950      };
23951      if (element.hasDescriptionElement()) {
23952        composeMarkdownCore("description", element.getDescriptionElement(), false);
23953        composeMarkdownExtras("description", element.getDescriptionElement(), false);
23954      }
23955      if (element.hasUseContext()) {
23956        openArray("useContext");
23957        for (UsageContext e : element.getUseContext()) 
23958          composeUsageContext(null, e);
23959        closeArray();
23960      };
23961      if (element.hasJurisdiction()) {
23962        openArray("jurisdiction");
23963        for (CodeableConcept e : element.getJurisdiction()) 
23964          composeCodeableConcept(null, e);
23965        closeArray();
23966      };
23967      if (element.hasPurposeElement()) {
23968        composeMarkdownCore("purpose", element.getPurposeElement(), false);
23969        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
23970      }
23971      if (element.hasCopyrightElement()) {
23972        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
23973        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
23974      }
23975      if (element.hasKindElement()) {
23976        composeEnumerationCore("kind", element.getKindElement(), new CapabilityStatement.CapabilityStatementKindEnumFactory(), false);
23977        composeEnumerationExtras("kind", element.getKindElement(), new CapabilityStatement.CapabilityStatementKindEnumFactory(), false);
23978      }
23979      if (element.hasInstantiates()) {
23980        openArray("instantiates");
23981        for (UriType e : element.getInstantiates()) 
23982          composeUriCore(null, e, true);
23983        closeArray();
23984        if (anyHasExtras(element.getInstantiates())) {
23985          openArray("_instantiates");
23986          for (UriType e : element.getInstantiates()) 
23987            composeUriExtras(null, e, true);
23988          closeArray();
23989        }
23990      };
23991      if (element.hasSoftware()) {
23992        composeCapabilityStatementCapabilityStatementSoftwareComponent("software", element.getSoftware());
23993      }
23994      if (element.hasImplementation()) {
23995        composeCapabilityStatementCapabilityStatementImplementationComponent("implementation", element.getImplementation());
23996      }
23997      if (element.hasFhirVersionElement()) {
23998        composeIdCore("fhirVersion", element.getFhirVersionElement(), false);
23999        composeIdExtras("fhirVersion", element.getFhirVersionElement(), false);
24000      }
24001      if (element.hasAcceptUnknownElement()) {
24002        composeEnumerationCore("acceptUnknown", element.getAcceptUnknownElement(), new CapabilityStatement.UnknownContentCodeEnumFactory(), false);
24003        composeEnumerationExtras("acceptUnknown", element.getAcceptUnknownElement(), new CapabilityStatement.UnknownContentCodeEnumFactory(), false);
24004      }
24005      if (element.hasFormat()) {
24006        openArray("format");
24007        for (CodeType e : element.getFormat()) 
24008          composeCodeCore(null, e, true);
24009        closeArray();
24010        if (anyHasExtras(element.getFormat())) {
24011          openArray("_format");
24012          for (CodeType e : element.getFormat()) 
24013            composeCodeExtras(null, e, true);
24014          closeArray();
24015        }
24016      };
24017      if (element.hasPatchFormat()) {
24018        openArray("patchFormat");
24019        for (CodeType e : element.getPatchFormat()) 
24020          composeCodeCore(null, e, true);
24021        closeArray();
24022        if (anyHasExtras(element.getPatchFormat())) {
24023          openArray("_patchFormat");
24024          for (CodeType e : element.getPatchFormat()) 
24025            composeCodeExtras(null, e, true);
24026          closeArray();
24027        }
24028      };
24029      if (element.hasImplementationGuide()) {
24030        openArray("implementationGuide");
24031        for (UriType e : element.getImplementationGuide()) 
24032          composeUriCore(null, e, true);
24033        closeArray();
24034        if (anyHasExtras(element.getImplementationGuide())) {
24035          openArray("_implementationGuide");
24036          for (UriType e : element.getImplementationGuide()) 
24037            composeUriExtras(null, e, true);
24038          closeArray();
24039        }
24040      };
24041      if (element.hasProfile()) {
24042        openArray("profile");
24043        for (Reference e : element.getProfile()) 
24044          composeReference(null, e);
24045        closeArray();
24046      };
24047      if (element.hasRest()) {
24048        openArray("rest");
24049        for (CapabilityStatement.CapabilityStatementRestComponent e : element.getRest()) 
24050          composeCapabilityStatementCapabilityStatementRestComponent(null, e);
24051        closeArray();
24052      };
24053      if (element.hasMessaging()) {
24054        openArray("messaging");
24055        for (CapabilityStatement.CapabilityStatementMessagingComponent e : element.getMessaging()) 
24056          composeCapabilityStatementCapabilityStatementMessagingComponent(null, e);
24057        closeArray();
24058      };
24059      if (element.hasDocument()) {
24060        openArray("document");
24061        for (CapabilityStatement.CapabilityStatementDocumentComponent e : element.getDocument()) 
24062          composeCapabilityStatementCapabilityStatementDocumentComponent(null, e);
24063        closeArray();
24064      };
24065  }
24066
24067  protected void composeCapabilityStatementCapabilityStatementSoftwareComponent(String name, CapabilityStatement.CapabilityStatementSoftwareComponent element) throws IOException {
24068    if (element != null) {
24069      open(name);
24070      composeCapabilityStatementCapabilityStatementSoftwareComponentInner(element);
24071      close();
24072    }
24073  }
24074
24075  protected void composeCapabilityStatementCapabilityStatementSoftwareComponentInner(CapabilityStatement.CapabilityStatementSoftwareComponent element) throws IOException {
24076      composeBackbone(element);
24077      if (element.hasNameElement()) {
24078        composeStringCore("name", element.getNameElement(), false);
24079        composeStringExtras("name", element.getNameElement(), false);
24080      }
24081      if (element.hasVersionElement()) {
24082        composeStringCore("version", element.getVersionElement(), false);
24083        composeStringExtras("version", element.getVersionElement(), false);
24084      }
24085      if (element.hasReleaseDateElement()) {
24086        composeDateTimeCore("releaseDate", element.getReleaseDateElement(), false);
24087        composeDateTimeExtras("releaseDate", element.getReleaseDateElement(), false);
24088      }
24089  }
24090
24091  protected void composeCapabilityStatementCapabilityStatementImplementationComponent(String name, CapabilityStatement.CapabilityStatementImplementationComponent element) throws IOException {
24092    if (element != null) {
24093      open(name);
24094      composeCapabilityStatementCapabilityStatementImplementationComponentInner(element);
24095      close();
24096    }
24097  }
24098
24099  protected void composeCapabilityStatementCapabilityStatementImplementationComponentInner(CapabilityStatement.CapabilityStatementImplementationComponent element) throws IOException {
24100      composeBackbone(element);
24101      if (element.hasDescriptionElement()) {
24102        composeStringCore("description", element.getDescriptionElement(), false);
24103        composeStringExtras("description", element.getDescriptionElement(), false);
24104      }
24105      if (element.hasUrlElement()) {
24106        composeUriCore("url", element.getUrlElement(), false);
24107        composeUriExtras("url", element.getUrlElement(), false);
24108      }
24109  }
24110
24111  protected void composeCapabilityStatementCapabilityStatementRestComponent(String name, CapabilityStatement.CapabilityStatementRestComponent element) throws IOException {
24112    if (element != null) {
24113      open(name);
24114      composeCapabilityStatementCapabilityStatementRestComponentInner(element);
24115      close();
24116    }
24117  }
24118
24119  protected void composeCapabilityStatementCapabilityStatementRestComponentInner(CapabilityStatement.CapabilityStatementRestComponent element) throws IOException {
24120      composeBackbone(element);
24121      if (element.hasModeElement()) {
24122        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.RestfulCapabilityModeEnumFactory(), false);
24123        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.RestfulCapabilityModeEnumFactory(), false);
24124      }
24125      if (element.hasDocumentationElement()) {
24126        composeStringCore("documentation", element.getDocumentationElement(), false);
24127        composeStringExtras("documentation", element.getDocumentationElement(), false);
24128      }
24129      if (element.hasSecurity()) {
24130        composeCapabilityStatementCapabilityStatementRestSecurityComponent("security", element.getSecurity());
24131      }
24132      if (element.hasResource()) {
24133        openArray("resource");
24134        for (CapabilityStatement.CapabilityStatementRestResourceComponent e : element.getResource()) 
24135          composeCapabilityStatementCapabilityStatementRestResourceComponent(null, e);
24136        closeArray();
24137      };
24138      if (element.hasInteraction()) {
24139        openArray("interaction");
24140        for (CapabilityStatement.SystemInteractionComponent e : element.getInteraction()) 
24141          composeCapabilityStatementSystemInteractionComponent(null, e);
24142        closeArray();
24143      };
24144      if (element.hasSearchParam()) {
24145        openArray("searchParam");
24146        for (CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent e : element.getSearchParam()) 
24147          composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(null, e);
24148        closeArray();
24149      };
24150      if (element.hasOperation()) {
24151        openArray("operation");
24152        for (CapabilityStatement.CapabilityStatementRestOperationComponent e : element.getOperation()) 
24153          composeCapabilityStatementCapabilityStatementRestOperationComponent(null, e);
24154        closeArray();
24155      };
24156      if (element.hasCompartment()) {
24157        openArray("compartment");
24158        for (UriType e : element.getCompartment()) 
24159          composeUriCore(null, e, true);
24160        closeArray();
24161        if (anyHasExtras(element.getCompartment())) {
24162          openArray("_compartment");
24163          for (UriType e : element.getCompartment()) 
24164            composeUriExtras(null, e, true);
24165          closeArray();
24166        }
24167      };
24168  }
24169
24170  protected void composeCapabilityStatementCapabilityStatementRestSecurityComponent(String name, CapabilityStatement.CapabilityStatementRestSecurityComponent element) throws IOException {
24171    if (element != null) {
24172      open(name);
24173      composeCapabilityStatementCapabilityStatementRestSecurityComponentInner(element);
24174      close();
24175    }
24176  }
24177
24178  protected void composeCapabilityStatementCapabilityStatementRestSecurityComponentInner(CapabilityStatement.CapabilityStatementRestSecurityComponent element) throws IOException {
24179      composeBackbone(element);
24180      if (element.hasCorsElement()) {
24181        composeBooleanCore("cors", element.getCorsElement(), false);
24182        composeBooleanExtras("cors", element.getCorsElement(), false);
24183      }
24184      if (element.hasService()) {
24185        openArray("service");
24186        for (CodeableConcept e : element.getService()) 
24187          composeCodeableConcept(null, e);
24188        closeArray();
24189      };
24190      if (element.hasDescriptionElement()) {
24191        composeStringCore("description", element.getDescriptionElement(), false);
24192        composeStringExtras("description", element.getDescriptionElement(), false);
24193      }
24194      if (element.hasCertificate()) {
24195        openArray("certificate");
24196        for (CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent e : element.getCertificate()) 
24197          composeCapabilityStatementCapabilityStatementRestSecurityCertificateComponent(null, e);
24198        closeArray();
24199      };
24200  }
24201
24202  protected void composeCapabilityStatementCapabilityStatementRestSecurityCertificateComponent(String name, CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent element) throws IOException {
24203    if (element != null) {
24204      open(name);
24205      composeCapabilityStatementCapabilityStatementRestSecurityCertificateComponentInner(element);
24206      close();
24207    }
24208  }
24209
24210  protected void composeCapabilityStatementCapabilityStatementRestSecurityCertificateComponentInner(CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent element) throws IOException {
24211      composeBackbone(element);
24212      if (element.hasTypeElement()) {
24213        composeCodeCore("type", element.getTypeElement(), false);
24214        composeCodeExtras("type", element.getTypeElement(), false);
24215      }
24216      if (element.hasBlobElement()) {
24217        composeBase64BinaryCore("blob", element.getBlobElement(), false);
24218        composeBase64BinaryExtras("blob", element.getBlobElement(), false);
24219      }
24220  }
24221
24222  protected void composeCapabilityStatementCapabilityStatementRestResourceComponent(String name, CapabilityStatement.CapabilityStatementRestResourceComponent element) throws IOException {
24223    if (element != null) {
24224      open(name);
24225      composeCapabilityStatementCapabilityStatementRestResourceComponentInner(element);
24226      close();
24227    }
24228  }
24229
24230  protected void composeCapabilityStatementCapabilityStatementRestResourceComponentInner(CapabilityStatement.CapabilityStatementRestResourceComponent element) throws IOException {
24231      composeBackbone(element);
24232      if (element.hasTypeElement()) {
24233        composeCodeCore("type", element.getTypeElement(), false);
24234        composeCodeExtras("type", element.getTypeElement(), false);
24235      }
24236      if (element.hasProfile()) {
24237        composeReference("profile", element.getProfile());
24238      }
24239      if (element.hasDocumentationElement()) {
24240        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
24241        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
24242      }
24243      if (element.hasInteraction()) {
24244        openArray("interaction");
24245        for (CapabilityStatement.ResourceInteractionComponent e : element.getInteraction()) 
24246          composeCapabilityStatementResourceInteractionComponent(null, e);
24247        closeArray();
24248      };
24249      if (element.hasVersioningElement()) {
24250        composeEnumerationCore("versioning", element.getVersioningElement(), new CapabilityStatement.ResourceVersionPolicyEnumFactory(), false);
24251        composeEnumerationExtras("versioning", element.getVersioningElement(), new CapabilityStatement.ResourceVersionPolicyEnumFactory(), false);
24252      }
24253      if (element.hasReadHistoryElement()) {
24254        composeBooleanCore("readHistory", element.getReadHistoryElement(), false);
24255        composeBooleanExtras("readHistory", element.getReadHistoryElement(), false);
24256      }
24257      if (element.hasUpdateCreateElement()) {
24258        composeBooleanCore("updateCreate", element.getUpdateCreateElement(), false);
24259        composeBooleanExtras("updateCreate", element.getUpdateCreateElement(), false);
24260      }
24261      if (element.hasConditionalCreateElement()) {
24262        composeBooleanCore("conditionalCreate", element.getConditionalCreateElement(), false);
24263        composeBooleanExtras("conditionalCreate", element.getConditionalCreateElement(), false);
24264      }
24265      if (element.hasConditionalReadElement()) {
24266        composeEnumerationCore("conditionalRead", element.getConditionalReadElement(), new CapabilityStatement.ConditionalReadStatusEnumFactory(), false);
24267        composeEnumerationExtras("conditionalRead", element.getConditionalReadElement(), new CapabilityStatement.ConditionalReadStatusEnumFactory(), false);
24268      }
24269      if (element.hasConditionalUpdateElement()) {
24270        composeBooleanCore("conditionalUpdate", element.getConditionalUpdateElement(), false);
24271        composeBooleanExtras("conditionalUpdate", element.getConditionalUpdateElement(), false);
24272      }
24273      if (element.hasConditionalDeleteElement()) {
24274        composeEnumerationCore("conditionalDelete", element.getConditionalDeleteElement(), new CapabilityStatement.ConditionalDeleteStatusEnumFactory(), false);
24275        composeEnumerationExtras("conditionalDelete", element.getConditionalDeleteElement(), new CapabilityStatement.ConditionalDeleteStatusEnumFactory(), false);
24276      }
24277      if (element.hasReferencePolicy()) {
24278        openArray("referencePolicy");
24279        for (Enumeration<CapabilityStatement.ReferenceHandlingPolicy> e : element.getReferencePolicy()) 
24280          composeEnumerationCore(null, e, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory(), true);
24281        closeArray();
24282        if (anyHasExtras(element.getReferencePolicy())) {
24283          openArray("_referencePolicy");
24284          for (Enumeration<CapabilityStatement.ReferenceHandlingPolicy> e : element.getReferencePolicy()) 
24285            composeEnumerationExtras(null, e, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory(), true);
24286          closeArray();
24287        }
24288      };
24289      if (element.hasSearchInclude()) {
24290        openArray("searchInclude");
24291        for (StringType e : element.getSearchInclude()) 
24292          composeStringCore(null, e, true);
24293        closeArray();
24294        if (anyHasExtras(element.getSearchInclude())) {
24295          openArray("_searchInclude");
24296          for (StringType e : element.getSearchInclude()) 
24297            composeStringExtras(null, e, true);
24298          closeArray();
24299        }
24300      };
24301      if (element.hasSearchRevInclude()) {
24302        openArray("searchRevInclude");
24303        for (StringType e : element.getSearchRevInclude()) 
24304          composeStringCore(null, e, true);
24305        closeArray();
24306        if (anyHasExtras(element.getSearchRevInclude())) {
24307          openArray("_searchRevInclude");
24308          for (StringType e : element.getSearchRevInclude()) 
24309            composeStringExtras(null, e, true);
24310          closeArray();
24311        }
24312      };
24313      if (element.hasSearchParam()) {
24314        openArray("searchParam");
24315        for (CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent e : element.getSearchParam()) 
24316          composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(null, e);
24317        closeArray();
24318      };
24319  }
24320
24321  protected void composeCapabilityStatementResourceInteractionComponent(String name, CapabilityStatement.ResourceInteractionComponent element) throws IOException {
24322    if (element != null) {
24323      open(name);
24324      composeCapabilityStatementResourceInteractionComponentInner(element);
24325      close();
24326    }
24327  }
24328
24329  protected void composeCapabilityStatementResourceInteractionComponentInner(CapabilityStatement.ResourceInteractionComponent element) throws IOException {
24330      composeBackbone(element);
24331      if (element.hasCodeElement()) {
24332        composeEnumerationCore("code", element.getCodeElement(), new CapabilityStatement.TypeRestfulInteractionEnumFactory(), false);
24333        composeEnumerationExtras("code", element.getCodeElement(), new CapabilityStatement.TypeRestfulInteractionEnumFactory(), false);
24334      }
24335      if (element.hasDocumentationElement()) {
24336        composeStringCore("documentation", element.getDocumentationElement(), false);
24337        composeStringExtras("documentation", element.getDocumentationElement(), false);
24338      }
24339  }
24340
24341  protected void composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(String name, CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent element) throws IOException {
24342    if (element != null) {
24343      open(name);
24344      composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponentInner(element);
24345      close();
24346    }
24347  }
24348
24349  protected void composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponentInner(CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent element) throws IOException {
24350      composeBackbone(element);
24351      if (element.hasNameElement()) {
24352        composeStringCore("name", element.getNameElement(), false);
24353        composeStringExtras("name", element.getNameElement(), false);
24354      }
24355      if (element.hasDefinitionElement()) {
24356        composeUriCore("definition", element.getDefinitionElement(), false);
24357        composeUriExtras("definition", element.getDefinitionElement(), false);
24358      }
24359      if (element.hasTypeElement()) {
24360        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
24361        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
24362      }
24363      if (element.hasDocumentationElement()) {
24364        composeStringCore("documentation", element.getDocumentationElement(), false);
24365        composeStringExtras("documentation", element.getDocumentationElement(), false);
24366      }
24367  }
24368
24369  protected void composeCapabilityStatementSystemInteractionComponent(String name, CapabilityStatement.SystemInteractionComponent element) throws IOException {
24370    if (element != null) {
24371      open(name);
24372      composeCapabilityStatementSystemInteractionComponentInner(element);
24373      close();
24374    }
24375  }
24376
24377  protected void composeCapabilityStatementSystemInteractionComponentInner(CapabilityStatement.SystemInteractionComponent element) throws IOException {
24378      composeBackbone(element);
24379      if (element.hasCodeElement()) {
24380        composeEnumerationCore("code", element.getCodeElement(), new CapabilityStatement.SystemRestfulInteractionEnumFactory(), false);
24381        composeEnumerationExtras("code", element.getCodeElement(), new CapabilityStatement.SystemRestfulInteractionEnumFactory(), false);
24382      }
24383      if (element.hasDocumentationElement()) {
24384        composeStringCore("documentation", element.getDocumentationElement(), false);
24385        composeStringExtras("documentation", element.getDocumentationElement(), false);
24386      }
24387  }
24388
24389  protected void composeCapabilityStatementCapabilityStatementRestOperationComponent(String name, CapabilityStatement.CapabilityStatementRestOperationComponent element) throws IOException {
24390    if (element != null) {
24391      open(name);
24392      composeCapabilityStatementCapabilityStatementRestOperationComponentInner(element);
24393      close();
24394    }
24395  }
24396
24397  protected void composeCapabilityStatementCapabilityStatementRestOperationComponentInner(CapabilityStatement.CapabilityStatementRestOperationComponent element) throws IOException {
24398      composeBackbone(element);
24399      if (element.hasNameElement()) {
24400        composeStringCore("name", element.getNameElement(), false);
24401        composeStringExtras("name", element.getNameElement(), false);
24402      }
24403      if (element.hasDefinition()) {
24404        composeReference("definition", element.getDefinition());
24405      }
24406  }
24407
24408  protected void composeCapabilityStatementCapabilityStatementMessagingComponent(String name, CapabilityStatement.CapabilityStatementMessagingComponent element) throws IOException {
24409    if (element != null) {
24410      open(name);
24411      composeCapabilityStatementCapabilityStatementMessagingComponentInner(element);
24412      close();
24413    }
24414  }
24415
24416  protected void composeCapabilityStatementCapabilityStatementMessagingComponentInner(CapabilityStatement.CapabilityStatementMessagingComponent element) throws IOException {
24417      composeBackbone(element);
24418      if (element.hasEndpoint()) {
24419        openArray("endpoint");
24420        for (CapabilityStatement.CapabilityStatementMessagingEndpointComponent e : element.getEndpoint()) 
24421          composeCapabilityStatementCapabilityStatementMessagingEndpointComponent(null, e);
24422        closeArray();
24423      };
24424      if (element.hasReliableCacheElement()) {
24425        composeUnsignedIntCore("reliableCache", element.getReliableCacheElement(), false);
24426        composeUnsignedIntExtras("reliableCache", element.getReliableCacheElement(), false);
24427      }
24428      if (element.hasDocumentationElement()) {
24429        composeStringCore("documentation", element.getDocumentationElement(), false);
24430        composeStringExtras("documentation", element.getDocumentationElement(), false);
24431      }
24432      if (element.hasSupportedMessage()) {
24433        openArray("supportedMessage");
24434        for (CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent e : element.getSupportedMessage()) 
24435          composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(null, e);
24436        closeArray();
24437      };
24438      if (element.hasEvent()) {
24439        openArray("event");
24440        for (CapabilityStatement.CapabilityStatementMessagingEventComponent e : element.getEvent()) 
24441          composeCapabilityStatementCapabilityStatementMessagingEventComponent(null, e);
24442        closeArray();
24443      };
24444  }
24445
24446  protected void composeCapabilityStatementCapabilityStatementMessagingEndpointComponent(String name, CapabilityStatement.CapabilityStatementMessagingEndpointComponent element) throws IOException {
24447    if (element != null) {
24448      open(name);
24449      composeCapabilityStatementCapabilityStatementMessagingEndpointComponentInner(element);
24450      close();
24451    }
24452  }
24453
24454  protected void composeCapabilityStatementCapabilityStatementMessagingEndpointComponentInner(CapabilityStatement.CapabilityStatementMessagingEndpointComponent element) throws IOException {
24455      composeBackbone(element);
24456      if (element.hasProtocol()) {
24457        composeCoding("protocol", element.getProtocol());
24458      }
24459      if (element.hasAddressElement()) {
24460        composeUriCore("address", element.getAddressElement(), false);
24461        composeUriExtras("address", element.getAddressElement(), false);
24462      }
24463  }
24464
24465  protected void composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(String name, CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent element) throws IOException {
24466    if (element != null) {
24467      open(name);
24468      composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentInner(element);
24469      close();
24470    }
24471  }
24472
24473  protected void composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentInner(CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent element) throws IOException {
24474      composeBackbone(element);
24475      if (element.hasModeElement()) {
24476        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.EventCapabilityModeEnumFactory(), false);
24477        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.EventCapabilityModeEnumFactory(), false);
24478      }
24479      if (element.hasDefinition()) {
24480        composeReference("definition", element.getDefinition());
24481      }
24482  }
24483
24484  protected void composeCapabilityStatementCapabilityStatementMessagingEventComponent(String name, CapabilityStatement.CapabilityStatementMessagingEventComponent element) throws IOException {
24485    if (element != null) {
24486      open(name);
24487      composeCapabilityStatementCapabilityStatementMessagingEventComponentInner(element);
24488      close();
24489    }
24490  }
24491
24492  protected void composeCapabilityStatementCapabilityStatementMessagingEventComponentInner(CapabilityStatement.CapabilityStatementMessagingEventComponent element) throws IOException {
24493      composeBackbone(element);
24494      if (element.hasCode()) {
24495        composeCoding("code", element.getCode());
24496      }
24497      if (element.hasCategoryElement()) {
24498        composeEnumerationCore("category", element.getCategoryElement(), new CapabilityStatement.MessageSignificanceCategoryEnumFactory(), false);
24499        composeEnumerationExtras("category", element.getCategoryElement(), new CapabilityStatement.MessageSignificanceCategoryEnumFactory(), false);
24500      }
24501      if (element.hasModeElement()) {
24502        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.EventCapabilityModeEnumFactory(), false);
24503        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.EventCapabilityModeEnumFactory(), false);
24504      }
24505      if (element.hasFocusElement()) {
24506        composeCodeCore("focus", element.getFocusElement(), false);
24507        composeCodeExtras("focus", element.getFocusElement(), false);
24508      }
24509      if (element.hasRequest()) {
24510        composeReference("request", element.getRequest());
24511      }
24512      if (element.hasResponse()) {
24513        composeReference("response", element.getResponse());
24514      }
24515      if (element.hasDocumentationElement()) {
24516        composeStringCore("documentation", element.getDocumentationElement(), false);
24517        composeStringExtras("documentation", element.getDocumentationElement(), false);
24518      }
24519  }
24520
24521  protected void composeCapabilityStatementCapabilityStatementDocumentComponent(String name, CapabilityStatement.CapabilityStatementDocumentComponent element) throws IOException {
24522    if (element != null) {
24523      open(name);
24524      composeCapabilityStatementCapabilityStatementDocumentComponentInner(element);
24525      close();
24526    }
24527  }
24528
24529  protected void composeCapabilityStatementCapabilityStatementDocumentComponentInner(CapabilityStatement.CapabilityStatementDocumentComponent element) throws IOException {
24530      composeBackbone(element);
24531      if (element.hasModeElement()) {
24532        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.DocumentModeEnumFactory(), false);
24533        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.DocumentModeEnumFactory(), false);
24534      }
24535      if (element.hasDocumentationElement()) {
24536        composeStringCore("documentation", element.getDocumentationElement(), false);
24537        composeStringExtras("documentation", element.getDocumentationElement(), false);
24538      }
24539      if (element.hasProfile()) {
24540        composeReference("profile", element.getProfile());
24541      }
24542  }
24543
24544  protected void composeCarePlan(String name, CarePlan element) throws IOException {
24545    if (element != null) {
24546      prop("resourceType", name);
24547      composeCarePlanInner(element);
24548    }
24549  }
24550
24551  protected void composeCarePlanInner(CarePlan element) throws IOException {
24552      composeDomainResourceElements(element);
24553      if (element.hasIdentifier()) {
24554        openArray("identifier");
24555        for (Identifier e : element.getIdentifier()) 
24556          composeIdentifier(null, e);
24557        closeArray();
24558      };
24559      if (element.hasDefinition()) {
24560        openArray("definition");
24561        for (Reference e : element.getDefinition()) 
24562          composeReference(null, e);
24563        closeArray();
24564      };
24565      if (element.hasBasedOn()) {
24566        openArray("basedOn");
24567        for (Reference e : element.getBasedOn()) 
24568          composeReference(null, e);
24569        closeArray();
24570      };
24571      if (element.hasReplaces()) {
24572        openArray("replaces");
24573        for (Reference e : element.getReplaces()) 
24574          composeReference(null, e);
24575        closeArray();
24576      };
24577      if (element.hasPartOf()) {
24578        openArray("partOf");
24579        for (Reference e : element.getPartOf()) 
24580          composeReference(null, e);
24581        closeArray();
24582      };
24583      if (element.hasStatusElement()) {
24584        composeEnumerationCore("status", element.getStatusElement(), new CarePlan.CarePlanStatusEnumFactory(), false);
24585        composeEnumerationExtras("status", element.getStatusElement(), new CarePlan.CarePlanStatusEnumFactory(), false);
24586      }
24587      if (element.hasIntentElement()) {
24588        composeEnumerationCore("intent", element.getIntentElement(), new CarePlan.CarePlanIntentEnumFactory(), false);
24589        composeEnumerationExtras("intent", element.getIntentElement(), new CarePlan.CarePlanIntentEnumFactory(), false);
24590      }
24591      if (element.hasCategory()) {
24592        openArray("category");
24593        for (CodeableConcept e : element.getCategory()) 
24594          composeCodeableConcept(null, e);
24595        closeArray();
24596      };
24597      if (element.hasTitleElement()) {
24598        composeStringCore("title", element.getTitleElement(), false);
24599        composeStringExtras("title", element.getTitleElement(), false);
24600      }
24601      if (element.hasDescriptionElement()) {
24602        composeStringCore("description", element.getDescriptionElement(), false);
24603        composeStringExtras("description", element.getDescriptionElement(), false);
24604      }
24605      if (element.hasSubject()) {
24606        composeReference("subject", element.getSubject());
24607      }
24608      if (element.hasContext()) {
24609        composeReference("context", element.getContext());
24610      }
24611      if (element.hasPeriod()) {
24612        composePeriod("period", element.getPeriod());
24613      }
24614      if (element.hasAuthor()) {
24615        openArray("author");
24616        for (Reference e : element.getAuthor()) 
24617          composeReference(null, e);
24618        closeArray();
24619      };
24620      if (element.hasCareTeam()) {
24621        openArray("careTeam");
24622        for (Reference e : element.getCareTeam()) 
24623          composeReference(null, e);
24624        closeArray();
24625      };
24626      if (element.hasAddresses()) {
24627        openArray("addresses");
24628        for (Reference e : element.getAddresses()) 
24629          composeReference(null, e);
24630        closeArray();
24631      };
24632      if (element.hasSupportingInfo()) {
24633        openArray("supportingInfo");
24634        for (Reference e : element.getSupportingInfo()) 
24635          composeReference(null, e);
24636        closeArray();
24637      };
24638      if (element.hasGoal()) {
24639        openArray("goal");
24640        for (Reference e : element.getGoal()) 
24641          composeReference(null, e);
24642        closeArray();
24643      };
24644      if (element.hasActivity()) {
24645        openArray("activity");
24646        for (CarePlan.CarePlanActivityComponent e : element.getActivity()) 
24647          composeCarePlanCarePlanActivityComponent(null, e);
24648        closeArray();
24649      };
24650      if (element.hasNote()) {
24651        openArray("note");
24652        for (Annotation e : element.getNote()) 
24653          composeAnnotation(null, e);
24654        closeArray();
24655      };
24656  }
24657
24658  protected void composeCarePlanCarePlanActivityComponent(String name, CarePlan.CarePlanActivityComponent element) throws IOException {
24659    if (element != null) {
24660      open(name);
24661      composeCarePlanCarePlanActivityComponentInner(element);
24662      close();
24663    }
24664  }
24665
24666  protected void composeCarePlanCarePlanActivityComponentInner(CarePlan.CarePlanActivityComponent element) throws IOException {
24667      composeBackbone(element);
24668      if (element.hasOutcomeCodeableConcept()) {
24669        openArray("outcomeCodeableConcept");
24670        for (CodeableConcept e : element.getOutcomeCodeableConcept()) 
24671          composeCodeableConcept(null, e);
24672        closeArray();
24673      };
24674      if (element.hasOutcomeReference()) {
24675        openArray("outcomeReference");
24676        for (Reference e : element.getOutcomeReference()) 
24677          composeReference(null, e);
24678        closeArray();
24679      };
24680      if (element.hasProgress()) {
24681        openArray("progress");
24682        for (Annotation e : element.getProgress()) 
24683          composeAnnotation(null, e);
24684        closeArray();
24685      };
24686      if (element.hasReference()) {
24687        composeReference("reference", element.getReference());
24688      }
24689      if (element.hasDetail()) {
24690        composeCarePlanCarePlanActivityDetailComponent("detail", element.getDetail());
24691      }
24692  }
24693
24694  protected void composeCarePlanCarePlanActivityDetailComponent(String name, CarePlan.CarePlanActivityDetailComponent element) throws IOException {
24695    if (element != null) {
24696      open(name);
24697      composeCarePlanCarePlanActivityDetailComponentInner(element);
24698      close();
24699    }
24700  }
24701
24702  protected void composeCarePlanCarePlanActivityDetailComponentInner(CarePlan.CarePlanActivityDetailComponent element) throws IOException {
24703      composeBackbone(element);
24704      if (element.hasCategory()) {
24705        composeCodeableConcept("category", element.getCategory());
24706      }
24707      if (element.hasDefinition()) {
24708        composeReference("definition", element.getDefinition());
24709      }
24710      if (element.hasCode()) {
24711        composeCodeableConcept("code", element.getCode());
24712      }
24713      if (element.hasReasonCode()) {
24714        openArray("reasonCode");
24715        for (CodeableConcept e : element.getReasonCode()) 
24716          composeCodeableConcept(null, e);
24717        closeArray();
24718      };
24719      if (element.hasReasonReference()) {
24720        openArray("reasonReference");
24721        for (Reference e : element.getReasonReference()) 
24722          composeReference(null, e);
24723        closeArray();
24724      };
24725      if (element.hasGoal()) {
24726        openArray("goal");
24727        for (Reference e : element.getGoal()) 
24728          composeReference(null, e);
24729        closeArray();
24730      };
24731      if (element.hasStatusElement()) {
24732        composeEnumerationCore("status", element.getStatusElement(), new CarePlan.CarePlanActivityStatusEnumFactory(), false);
24733        composeEnumerationExtras("status", element.getStatusElement(), new CarePlan.CarePlanActivityStatusEnumFactory(), false);
24734      }
24735      if (element.hasStatusReasonElement()) {
24736        composeStringCore("statusReason", element.getStatusReasonElement(), false);
24737        composeStringExtras("statusReason", element.getStatusReasonElement(), false);
24738      }
24739      if (element.hasProhibitedElement()) {
24740        composeBooleanCore("prohibited", element.getProhibitedElement(), false);
24741        composeBooleanExtras("prohibited", element.getProhibitedElement(), false);
24742      }
24743      if (element.hasScheduled()) {
24744        composeType("scheduled", element.getScheduled());
24745      }
24746      if (element.hasLocation()) {
24747        composeReference("location", element.getLocation());
24748      }
24749      if (element.hasPerformer()) {
24750        openArray("performer");
24751        for (Reference e : element.getPerformer()) 
24752          composeReference(null, e);
24753        closeArray();
24754      };
24755      if (element.hasProduct()) {
24756        composeType("product", element.getProduct());
24757      }
24758      if (element.hasDailyAmount()) {
24759        composeSimpleQuantity("dailyAmount", element.getDailyAmount());
24760      }
24761      if (element.hasQuantity()) {
24762        composeSimpleQuantity("quantity", element.getQuantity());
24763      }
24764      if (element.hasDescriptionElement()) {
24765        composeStringCore("description", element.getDescriptionElement(), false);
24766        composeStringExtras("description", element.getDescriptionElement(), false);
24767      }
24768  }
24769
24770  protected void composeCareTeam(String name, CareTeam element) throws IOException {
24771    if (element != null) {
24772      prop("resourceType", name);
24773      composeCareTeamInner(element);
24774    }
24775  }
24776
24777  protected void composeCareTeamInner(CareTeam element) throws IOException {
24778      composeDomainResourceElements(element);
24779      if (element.hasIdentifier()) {
24780        openArray("identifier");
24781        for (Identifier e : element.getIdentifier()) 
24782          composeIdentifier(null, e);
24783        closeArray();
24784      };
24785      if (element.hasStatusElement()) {
24786        composeEnumerationCore("status", element.getStatusElement(), new CareTeam.CareTeamStatusEnumFactory(), false);
24787        composeEnumerationExtras("status", element.getStatusElement(), new CareTeam.CareTeamStatusEnumFactory(), false);
24788      }
24789      if (element.hasCategory()) {
24790        openArray("category");
24791        for (CodeableConcept e : element.getCategory()) 
24792          composeCodeableConcept(null, e);
24793        closeArray();
24794      };
24795      if (element.hasNameElement()) {
24796        composeStringCore("name", element.getNameElement(), false);
24797        composeStringExtras("name", element.getNameElement(), false);
24798      }
24799      if (element.hasSubject()) {
24800        composeReference("subject", element.getSubject());
24801      }
24802      if (element.hasContext()) {
24803        composeReference("context", element.getContext());
24804      }
24805      if (element.hasPeriod()) {
24806        composePeriod("period", element.getPeriod());
24807      }
24808      if (element.hasParticipant()) {
24809        openArray("participant");
24810        for (CareTeam.CareTeamParticipantComponent e : element.getParticipant()) 
24811          composeCareTeamCareTeamParticipantComponent(null, e);
24812        closeArray();
24813      };
24814      if (element.hasReasonCode()) {
24815        openArray("reasonCode");
24816        for (CodeableConcept e : element.getReasonCode()) 
24817          composeCodeableConcept(null, e);
24818        closeArray();
24819      };
24820      if (element.hasReasonReference()) {
24821        openArray("reasonReference");
24822        for (Reference e : element.getReasonReference()) 
24823          composeReference(null, e);
24824        closeArray();
24825      };
24826      if (element.hasManagingOrganization()) {
24827        openArray("managingOrganization");
24828        for (Reference e : element.getManagingOrganization()) 
24829          composeReference(null, e);
24830        closeArray();
24831      };
24832      if (element.hasNote()) {
24833        openArray("note");
24834        for (Annotation e : element.getNote()) 
24835          composeAnnotation(null, e);
24836        closeArray();
24837      };
24838  }
24839
24840  protected void composeCareTeamCareTeamParticipantComponent(String name, CareTeam.CareTeamParticipantComponent element) throws IOException {
24841    if (element != null) {
24842      open(name);
24843      composeCareTeamCareTeamParticipantComponentInner(element);
24844      close();
24845    }
24846  }
24847
24848  protected void composeCareTeamCareTeamParticipantComponentInner(CareTeam.CareTeamParticipantComponent element) throws IOException {
24849      composeBackbone(element);
24850      if (element.hasRole()) {
24851        composeCodeableConcept("role", element.getRole());
24852      }
24853      if (element.hasMember()) {
24854        composeReference("member", element.getMember());
24855      }
24856      if (element.hasOnBehalfOf()) {
24857        composeReference("onBehalfOf", element.getOnBehalfOf());
24858      }
24859      if (element.hasPeriod()) {
24860        composePeriod("period", element.getPeriod());
24861      }
24862  }
24863
24864  protected void composeChargeItem(String name, ChargeItem element) throws IOException {
24865    if (element != null) {
24866      prop("resourceType", name);
24867      composeChargeItemInner(element);
24868    }
24869  }
24870
24871  protected void composeChargeItemInner(ChargeItem element) throws IOException {
24872      composeDomainResourceElements(element);
24873      if (element.hasIdentifier()) {
24874        composeIdentifier("identifier", element.getIdentifier());
24875      }
24876      if (element.hasDefinition()) {
24877        openArray("definition");
24878        for (UriType e : element.getDefinition()) 
24879          composeUriCore(null, e, true);
24880        closeArray();
24881        if (anyHasExtras(element.getDefinition())) {
24882          openArray("_definition");
24883          for (UriType e : element.getDefinition()) 
24884            composeUriExtras(null, e, true);
24885          closeArray();
24886        }
24887      };
24888      if (element.hasStatusElement()) {
24889        composeEnumerationCore("status", element.getStatusElement(), new ChargeItem.ChargeItemStatusEnumFactory(), false);
24890        composeEnumerationExtras("status", element.getStatusElement(), new ChargeItem.ChargeItemStatusEnumFactory(), false);
24891      }
24892      if (element.hasPartOf()) {
24893        openArray("partOf");
24894        for (Reference e : element.getPartOf()) 
24895          composeReference(null, e);
24896        closeArray();
24897      };
24898      if (element.hasCode()) {
24899        composeCodeableConcept("code", element.getCode());
24900      }
24901      if (element.hasSubject()) {
24902        composeReference("subject", element.getSubject());
24903      }
24904      if (element.hasContext()) {
24905        composeReference("context", element.getContext());
24906      }
24907      if (element.hasOccurrence()) {
24908        composeType("occurrence", element.getOccurrence());
24909      }
24910      if (element.hasParticipant()) {
24911        openArray("participant");
24912        for (ChargeItem.ChargeItemParticipantComponent e : element.getParticipant()) 
24913          composeChargeItemChargeItemParticipantComponent(null, e);
24914        closeArray();
24915      };
24916      if (element.hasPerformingOrganization()) {
24917        composeReference("performingOrganization", element.getPerformingOrganization());
24918      }
24919      if (element.hasRequestingOrganization()) {
24920        composeReference("requestingOrganization", element.getRequestingOrganization());
24921      }
24922      if (element.hasQuantity()) {
24923        composeQuantity("quantity", element.getQuantity());
24924      }
24925      if (element.hasBodysite()) {
24926        openArray("bodysite");
24927        for (CodeableConcept e : element.getBodysite()) 
24928          composeCodeableConcept(null, e);
24929        closeArray();
24930      };
24931      if (element.hasFactorOverrideElement()) {
24932        composeDecimalCore("factorOverride", element.getFactorOverrideElement(), false);
24933        composeDecimalExtras("factorOverride", element.getFactorOverrideElement(), false);
24934      }
24935      if (element.hasPriceOverride()) {
24936        composeMoney("priceOverride", element.getPriceOverride());
24937      }
24938      if (element.hasOverrideReasonElement()) {
24939        composeStringCore("overrideReason", element.getOverrideReasonElement(), false);
24940        composeStringExtras("overrideReason", element.getOverrideReasonElement(), false);
24941      }
24942      if (element.hasEnterer()) {
24943        composeReference("enterer", element.getEnterer());
24944      }
24945      if (element.hasEnteredDateElement()) {
24946        composeDateTimeCore("enteredDate", element.getEnteredDateElement(), false);
24947        composeDateTimeExtras("enteredDate", element.getEnteredDateElement(), false);
24948      }
24949      if (element.hasReason()) {
24950        openArray("reason");
24951        for (CodeableConcept e : element.getReason()) 
24952          composeCodeableConcept(null, e);
24953        closeArray();
24954      };
24955      if (element.hasService()) {
24956        openArray("service");
24957        for (Reference e : element.getService()) 
24958          composeReference(null, e);
24959        closeArray();
24960      };
24961      if (element.hasAccount()) {
24962        openArray("account");
24963        for (Reference e : element.getAccount()) 
24964          composeReference(null, e);
24965        closeArray();
24966      };
24967      if (element.hasNote()) {
24968        openArray("note");
24969        for (Annotation e : element.getNote()) 
24970          composeAnnotation(null, e);
24971        closeArray();
24972      };
24973      if (element.hasSupportingInformation()) {
24974        openArray("supportingInformation");
24975        for (Reference e : element.getSupportingInformation()) 
24976          composeReference(null, e);
24977        closeArray();
24978      };
24979  }
24980
24981  protected void composeChargeItemChargeItemParticipantComponent(String name, ChargeItem.ChargeItemParticipantComponent element) throws IOException {
24982    if (element != null) {
24983      open(name);
24984      composeChargeItemChargeItemParticipantComponentInner(element);
24985      close();
24986    }
24987  }
24988
24989  protected void composeChargeItemChargeItemParticipantComponentInner(ChargeItem.ChargeItemParticipantComponent element) throws IOException {
24990      composeBackbone(element);
24991      if (element.hasRole()) {
24992        composeCodeableConcept("role", element.getRole());
24993      }
24994      if (element.hasActor()) {
24995        composeReference("actor", element.getActor());
24996      }
24997  }
24998
24999  protected void composeClaim(String name, Claim element) throws IOException {
25000    if (element != null) {
25001      prop("resourceType", name);
25002      composeClaimInner(element);
25003    }
25004  }
25005
25006  protected void composeClaimInner(Claim element) throws IOException {
25007      composeDomainResourceElements(element);
25008      if (element.hasIdentifier()) {
25009        openArray("identifier");
25010        for (Identifier e : element.getIdentifier()) 
25011          composeIdentifier(null, e);
25012        closeArray();
25013      };
25014      if (element.hasStatusElement()) {
25015        composeEnumerationCore("status", element.getStatusElement(), new Claim.ClaimStatusEnumFactory(), false);
25016        composeEnumerationExtras("status", element.getStatusElement(), new Claim.ClaimStatusEnumFactory(), false);
25017      }
25018      if (element.hasType()) {
25019        composeCodeableConcept("type", element.getType());
25020      }
25021      if (element.hasSubType()) {
25022        openArray("subType");
25023        for (CodeableConcept e : element.getSubType()) 
25024          composeCodeableConcept(null, e);
25025        closeArray();
25026      };
25027      if (element.hasUseElement()) {
25028        composeEnumerationCore("use", element.getUseElement(), new Claim.UseEnumFactory(), false);
25029        composeEnumerationExtras("use", element.getUseElement(), new Claim.UseEnumFactory(), false);
25030      }
25031      if (element.hasPatient()) {
25032        composeReference("patient", element.getPatient());
25033      }
25034      if (element.hasBillablePeriod()) {
25035        composePeriod("billablePeriod", element.getBillablePeriod());
25036      }
25037      if (element.hasCreatedElement()) {
25038        composeDateTimeCore("created", element.getCreatedElement(), false);
25039        composeDateTimeExtras("created", element.getCreatedElement(), false);
25040      }
25041      if (element.hasEnterer()) {
25042        composeReference("enterer", element.getEnterer());
25043      }
25044      if (element.hasInsurer()) {
25045        composeReference("insurer", element.getInsurer());
25046      }
25047      if (element.hasProvider()) {
25048        composeReference("provider", element.getProvider());
25049      }
25050      if (element.hasOrganization()) {
25051        composeReference("organization", element.getOrganization());
25052      }
25053      if (element.hasPriority()) {
25054        composeCodeableConcept("priority", element.getPriority());
25055      }
25056      if (element.hasFundsReserve()) {
25057        composeCodeableConcept("fundsReserve", element.getFundsReserve());
25058      }
25059      if (element.hasRelated()) {
25060        openArray("related");
25061        for (Claim.RelatedClaimComponent e : element.getRelated()) 
25062          composeClaimRelatedClaimComponent(null, e);
25063        closeArray();
25064      };
25065      if (element.hasPrescription()) {
25066        composeReference("prescription", element.getPrescription());
25067      }
25068      if (element.hasOriginalPrescription()) {
25069        composeReference("originalPrescription", element.getOriginalPrescription());
25070      }
25071      if (element.hasPayee()) {
25072        composeClaimPayeeComponent("payee", element.getPayee());
25073      }
25074      if (element.hasReferral()) {
25075        composeReference("referral", element.getReferral());
25076      }
25077      if (element.hasFacility()) {
25078        composeReference("facility", element.getFacility());
25079      }
25080      if (element.hasCareTeam()) {
25081        openArray("careTeam");
25082        for (Claim.CareTeamComponent e : element.getCareTeam()) 
25083          composeClaimCareTeamComponent(null, e);
25084        closeArray();
25085      };
25086      if (element.hasInformation()) {
25087        openArray("information");
25088        for (Claim.SpecialConditionComponent e : element.getInformation()) 
25089          composeClaimSpecialConditionComponent(null, e);
25090        closeArray();
25091      };
25092      if (element.hasDiagnosis()) {
25093        openArray("diagnosis");
25094        for (Claim.DiagnosisComponent e : element.getDiagnosis()) 
25095          composeClaimDiagnosisComponent(null, e);
25096        closeArray();
25097      };
25098      if (element.hasProcedure()) {
25099        openArray("procedure");
25100        for (Claim.ProcedureComponent e : element.getProcedure()) 
25101          composeClaimProcedureComponent(null, e);
25102        closeArray();
25103      };
25104      if (element.hasInsurance()) {
25105        openArray("insurance");
25106        for (Claim.InsuranceComponent e : element.getInsurance()) 
25107          composeClaimInsuranceComponent(null, e);
25108        closeArray();
25109      };
25110      if (element.hasAccident()) {
25111        composeClaimAccidentComponent("accident", element.getAccident());
25112      }
25113      if (element.hasEmploymentImpacted()) {
25114        composePeriod("employmentImpacted", element.getEmploymentImpacted());
25115      }
25116      if (element.hasHospitalization()) {
25117        composePeriod("hospitalization", element.getHospitalization());
25118      }
25119      if (element.hasItem()) {
25120        openArray("item");
25121        for (Claim.ItemComponent e : element.getItem()) 
25122          composeClaimItemComponent(null, e);
25123        closeArray();
25124      };
25125      if (element.hasTotal()) {
25126        composeMoney("total", element.getTotal());
25127      }
25128  }
25129
25130  protected void composeClaimRelatedClaimComponent(String name, Claim.RelatedClaimComponent element) throws IOException {
25131    if (element != null) {
25132      open(name);
25133      composeClaimRelatedClaimComponentInner(element);
25134      close();
25135    }
25136  }
25137
25138  protected void composeClaimRelatedClaimComponentInner(Claim.RelatedClaimComponent element) throws IOException {
25139      composeBackbone(element);
25140      if (element.hasClaim()) {
25141        composeReference("claim", element.getClaim());
25142      }
25143      if (element.hasRelationship()) {
25144        composeCodeableConcept("relationship", element.getRelationship());
25145      }
25146      if (element.hasReference()) {
25147        composeIdentifier("reference", element.getReference());
25148      }
25149  }
25150
25151  protected void composeClaimPayeeComponent(String name, Claim.PayeeComponent element) throws IOException {
25152    if (element != null) {
25153      open(name);
25154      composeClaimPayeeComponentInner(element);
25155      close();
25156    }
25157  }
25158
25159  protected void composeClaimPayeeComponentInner(Claim.PayeeComponent element) throws IOException {
25160      composeBackbone(element);
25161      if (element.hasType()) {
25162        composeCodeableConcept("type", element.getType());
25163      }
25164      if (element.hasResourceType()) {
25165        composeCoding("resourceType", element.getResourceType());
25166      }
25167      if (element.hasParty()) {
25168        composeReference("party", element.getParty());
25169      }
25170  }
25171
25172  protected void composeClaimCareTeamComponent(String name, Claim.CareTeamComponent element) throws IOException {
25173    if (element != null) {
25174      open(name);
25175      composeClaimCareTeamComponentInner(element);
25176      close();
25177    }
25178  }
25179
25180  protected void composeClaimCareTeamComponentInner(Claim.CareTeamComponent element) throws IOException {
25181      composeBackbone(element);
25182      if (element.hasSequenceElement()) {
25183        composePositiveIntCore("sequence", element.getSequenceElement(), false);
25184        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
25185      }
25186      if (element.hasProvider()) {
25187        composeReference("provider", element.getProvider());
25188      }
25189      if (element.hasResponsibleElement()) {
25190        composeBooleanCore("responsible", element.getResponsibleElement(), false);
25191        composeBooleanExtras("responsible", element.getResponsibleElement(), false);
25192      }
25193      if (element.hasRole()) {
25194        composeCodeableConcept("role", element.getRole());
25195      }
25196      if (element.hasQualification()) {
25197        composeCodeableConcept("qualification", element.getQualification());
25198      }
25199  }
25200
25201  protected void composeClaimSpecialConditionComponent(String name, Claim.SpecialConditionComponent element) throws IOException {
25202    if (element != null) {
25203      open(name);
25204      composeClaimSpecialConditionComponentInner(element);
25205      close();
25206    }
25207  }
25208
25209  protected void composeClaimSpecialConditionComponentInner(Claim.SpecialConditionComponent element) throws IOException {
25210      composeBackbone(element);
25211      if (element.hasSequenceElement()) {
25212        composePositiveIntCore("sequence", element.getSequenceElement(), false);
25213        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
25214      }
25215      if (element.hasCategory()) {
25216        composeCodeableConcept("category", element.getCategory());
25217      }
25218      if (element.hasCode()) {
25219        composeCodeableConcept("code", element.getCode());
25220      }
25221      if (element.hasTiming()) {
25222        composeType("timing", element.getTiming());
25223      }
25224      if (element.hasValue()) {
25225        composeType("value", element.getValue());
25226      }
25227      if (element.hasReason()) {
25228        composeCodeableConcept("reason", element.getReason());
25229      }
25230  }
25231
25232  protected void composeClaimDiagnosisComponent(String name, Claim.DiagnosisComponent element) throws IOException {
25233    if (element != null) {
25234      open(name);
25235      composeClaimDiagnosisComponentInner(element);
25236      close();
25237    }
25238  }
25239
25240  protected void composeClaimDiagnosisComponentInner(Claim.DiagnosisComponent element) throws IOException {
25241      composeBackbone(element);
25242      if (element.hasSequenceElement()) {
25243        composePositiveIntCore("sequence", element.getSequenceElement(), false);
25244        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
25245      }
25246      if (element.hasDiagnosis()) {
25247        composeType("diagnosis", element.getDiagnosis());
25248      }
25249      if (element.hasType()) {
25250        openArray("type");
25251        for (CodeableConcept e : element.getType()) 
25252          composeCodeableConcept(null, e);
25253        closeArray();
25254      };
25255      if (element.hasPackageCode()) {
25256        composeCodeableConcept("packageCode", element.getPackageCode());
25257      }
25258  }
25259
25260  protected void composeClaimProcedureComponent(String name, Claim.ProcedureComponent element) throws IOException {
25261    if (element != null) {
25262      open(name);
25263      composeClaimProcedureComponentInner(element);
25264      close();
25265    }
25266  }
25267
25268  protected void composeClaimProcedureComponentInner(Claim.ProcedureComponent element) throws IOException {
25269      composeBackbone(element);
25270      if (element.hasSequenceElement()) {
25271        composePositiveIntCore("sequence", element.getSequenceElement(), false);
25272        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
25273      }
25274      if (element.hasDateElement()) {
25275        composeDateTimeCore("date", element.getDateElement(), false);
25276        composeDateTimeExtras("date", element.getDateElement(), false);
25277      }
25278      if (element.hasProcedure()) {
25279        composeType("procedure", element.getProcedure());
25280      }
25281  }
25282
25283  protected void composeClaimInsuranceComponent(String name, Claim.InsuranceComponent element) throws IOException {
25284    if (element != null) {
25285      open(name);
25286      composeClaimInsuranceComponentInner(element);
25287      close();
25288    }
25289  }
25290
25291  protected void composeClaimInsuranceComponentInner(Claim.InsuranceComponent element) throws IOException {
25292      composeBackbone(element);
25293      if (element.hasSequenceElement()) {
25294        composePositiveIntCore("sequence", element.getSequenceElement(), false);
25295        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
25296      }
25297      if (element.hasFocalElement()) {
25298        composeBooleanCore("focal", element.getFocalElement(), false);
25299        composeBooleanExtras("focal", element.getFocalElement(), false);
25300      }
25301      if (element.hasCoverage()) {
25302        composeReference("coverage", element.getCoverage());
25303      }
25304      if (element.hasBusinessArrangementElement()) {
25305        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
25306        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
25307      }
25308      if (element.hasPreAuthRef()) {
25309        openArray("preAuthRef");
25310        for (StringType e : element.getPreAuthRef()) 
25311          composeStringCore(null, e, true);
25312        closeArray();
25313        if (anyHasExtras(element.getPreAuthRef())) {
25314          openArray("_preAuthRef");
25315          for (StringType e : element.getPreAuthRef()) 
25316            composeStringExtras(null, e, true);
25317          closeArray();
25318        }
25319      };
25320      if (element.hasClaimResponse()) {
25321        composeReference("claimResponse", element.getClaimResponse());
25322      }
25323  }
25324
25325  protected void composeClaimAccidentComponent(String name, Claim.AccidentComponent element) throws IOException {
25326    if (element != null) {
25327      open(name);
25328      composeClaimAccidentComponentInner(element);
25329      close();
25330    }
25331  }
25332
25333  protected void composeClaimAccidentComponentInner(Claim.AccidentComponent element) throws IOException {
25334      composeBackbone(element);
25335      if (element.hasDateElement()) {
25336        composeDateCore("date", element.getDateElement(), false);
25337        composeDateExtras("date", element.getDateElement(), false);
25338      }
25339      if (element.hasType()) {
25340        composeCodeableConcept("type", element.getType());
25341      }
25342      if (element.hasLocation()) {
25343        composeType("location", element.getLocation());
25344      }
25345  }
25346
25347  protected void composeClaimItemComponent(String name, Claim.ItemComponent element) throws IOException {
25348    if (element != null) {
25349      open(name);
25350      composeClaimItemComponentInner(element);
25351      close();
25352    }
25353  }
25354
25355  protected void composeClaimItemComponentInner(Claim.ItemComponent element) throws IOException {
25356      composeBackbone(element);
25357      if (element.hasSequenceElement()) {
25358        composePositiveIntCore("sequence", element.getSequenceElement(), false);
25359        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
25360      }
25361      if (element.hasCareTeamLinkId()) {
25362        openArray("careTeamLinkId");
25363        for (PositiveIntType e : element.getCareTeamLinkId()) 
25364          composePositiveIntCore(null, e, true);
25365        closeArray();
25366        if (anyHasExtras(element.getCareTeamLinkId())) {
25367          openArray("_careTeamLinkId");
25368          for (PositiveIntType e : element.getCareTeamLinkId()) 
25369            composePositiveIntExtras(null, e, true);
25370          closeArray();
25371        }
25372      };
25373      if (element.hasDiagnosisLinkId()) {
25374        openArray("diagnosisLinkId");
25375        for (PositiveIntType e : element.getDiagnosisLinkId()) 
25376          composePositiveIntCore(null, e, true);
25377        closeArray();
25378        if (anyHasExtras(element.getDiagnosisLinkId())) {
25379          openArray("_diagnosisLinkId");
25380          for (PositiveIntType e : element.getDiagnosisLinkId()) 
25381            composePositiveIntExtras(null, e, true);
25382          closeArray();
25383        }
25384      };
25385      if (element.hasProcedureLinkId()) {
25386        openArray("procedureLinkId");
25387        for (PositiveIntType e : element.getProcedureLinkId()) 
25388          composePositiveIntCore(null, e, true);
25389        closeArray();
25390        if (anyHasExtras(element.getProcedureLinkId())) {
25391          openArray("_procedureLinkId");
25392          for (PositiveIntType e : element.getProcedureLinkId()) 
25393            composePositiveIntExtras(null, e, true);
25394          closeArray();
25395        }
25396      };
25397      if (element.hasInformationLinkId()) {
25398        openArray("informationLinkId");
25399        for (PositiveIntType e : element.getInformationLinkId()) 
25400          composePositiveIntCore(null, e, true);
25401        closeArray();
25402        if (anyHasExtras(element.getInformationLinkId())) {
25403          openArray("_informationLinkId");
25404          for (PositiveIntType e : element.getInformationLinkId()) 
25405            composePositiveIntExtras(null, e, true);
25406          closeArray();
25407        }
25408      };
25409      if (element.hasRevenue()) {
25410        composeCodeableConcept("revenue", element.getRevenue());
25411      }
25412      if (element.hasCategory()) {
25413        composeCodeableConcept("category", element.getCategory());
25414      }
25415      if (element.hasService()) {
25416        composeCodeableConcept("service", element.getService());
25417      }
25418      if (element.hasModifier()) {
25419        openArray("modifier");
25420        for (CodeableConcept e : element.getModifier()) 
25421          composeCodeableConcept(null, e);
25422        closeArray();
25423      };
25424      if (element.hasProgramCode()) {
25425        openArray("programCode");
25426        for (CodeableConcept e : element.getProgramCode()) 
25427          composeCodeableConcept(null, e);
25428        closeArray();
25429      };
25430      if (element.hasServiced()) {
25431        composeType("serviced", element.getServiced());
25432      }
25433      if (element.hasLocation()) {
25434        composeType("location", element.getLocation());
25435      }
25436      if (element.hasQuantity()) {
25437        composeSimpleQuantity("quantity", element.getQuantity());
25438      }
25439      if (element.hasUnitPrice()) {
25440        composeMoney("unitPrice", element.getUnitPrice());
25441      }
25442      if (element.hasFactorElement()) {
25443        composeDecimalCore("factor", element.getFactorElement(), false);
25444        composeDecimalExtras("factor", element.getFactorElement(), false);
25445      }
25446      if (element.hasNet()) {
25447        composeMoney("net", element.getNet());
25448      }
25449      if (element.hasUdi()) {
25450        openArray("udi");
25451        for (Reference e : element.getUdi()) 
25452          composeReference(null, e);
25453        closeArray();
25454      };
25455      if (element.hasBodySite()) {
25456        composeCodeableConcept("bodySite", element.getBodySite());
25457      }
25458      if (element.hasSubSite()) {
25459        openArray("subSite");
25460        for (CodeableConcept e : element.getSubSite()) 
25461          composeCodeableConcept(null, e);
25462        closeArray();
25463      };
25464      if (element.hasEncounter()) {
25465        openArray("encounter");
25466        for (Reference e : element.getEncounter()) 
25467          composeReference(null, e);
25468        closeArray();
25469      };
25470      if (element.hasDetail()) {
25471        openArray("detail");
25472        for (Claim.DetailComponent e : element.getDetail()) 
25473          composeClaimDetailComponent(null, e);
25474        closeArray();
25475      };
25476  }
25477
25478  protected void composeClaimDetailComponent(String name, Claim.DetailComponent element) throws IOException {
25479    if (element != null) {
25480      open(name);
25481      composeClaimDetailComponentInner(element);
25482      close();
25483    }
25484  }
25485
25486  protected void composeClaimDetailComponentInner(Claim.DetailComponent element) throws IOException {
25487      composeBackbone(element);
25488      if (element.hasSequenceElement()) {
25489        composePositiveIntCore("sequence", element.getSequenceElement(), false);
25490        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
25491      }
25492      if (element.hasRevenue()) {
25493        composeCodeableConcept("revenue", element.getRevenue());
25494      }
25495      if (element.hasCategory()) {
25496        composeCodeableConcept("category", element.getCategory());
25497      }
25498      if (element.hasService()) {
25499        composeCodeableConcept("service", element.getService());
25500      }
25501      if (element.hasModifier()) {
25502        openArray("modifier");
25503        for (CodeableConcept e : element.getModifier()) 
25504          composeCodeableConcept(null, e);
25505        closeArray();
25506      };
25507      if (element.hasProgramCode()) {
25508        openArray("programCode");
25509        for (CodeableConcept e : element.getProgramCode()) 
25510          composeCodeableConcept(null, e);
25511        closeArray();
25512      };
25513      if (element.hasQuantity()) {
25514        composeSimpleQuantity("quantity", element.getQuantity());
25515      }
25516      if (element.hasUnitPrice()) {
25517        composeMoney("unitPrice", element.getUnitPrice());
25518      }
25519      if (element.hasFactorElement()) {
25520        composeDecimalCore("factor", element.getFactorElement(), false);
25521        composeDecimalExtras("factor", element.getFactorElement(), false);
25522      }
25523      if (element.hasNet()) {
25524        composeMoney("net", element.getNet());
25525      }
25526      if (element.hasUdi()) {
25527        openArray("udi");
25528        for (Reference e : element.getUdi()) 
25529          composeReference(null, e);
25530        closeArray();
25531      };
25532      if (element.hasSubDetail()) {
25533        openArray("subDetail");
25534        for (Claim.SubDetailComponent e : element.getSubDetail()) 
25535          composeClaimSubDetailComponent(null, e);
25536        closeArray();
25537      };
25538  }
25539
25540  protected void composeClaimSubDetailComponent(String name, Claim.SubDetailComponent element) throws IOException {
25541    if (element != null) {
25542      open(name);
25543      composeClaimSubDetailComponentInner(element);
25544      close();
25545    }
25546  }
25547
25548  protected void composeClaimSubDetailComponentInner(Claim.SubDetailComponent element) throws IOException {
25549      composeBackbone(element);
25550      if (element.hasSequenceElement()) {
25551        composePositiveIntCore("sequence", element.getSequenceElement(), false);
25552        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
25553      }
25554      if (element.hasRevenue()) {
25555        composeCodeableConcept("revenue", element.getRevenue());
25556      }
25557      if (element.hasCategory()) {
25558        composeCodeableConcept("category", element.getCategory());
25559      }
25560      if (element.hasService()) {
25561        composeCodeableConcept("service", element.getService());
25562      }
25563      if (element.hasModifier()) {
25564        openArray("modifier");
25565        for (CodeableConcept e : element.getModifier()) 
25566          composeCodeableConcept(null, e);
25567        closeArray();
25568      };
25569      if (element.hasProgramCode()) {
25570        openArray("programCode");
25571        for (CodeableConcept e : element.getProgramCode()) 
25572          composeCodeableConcept(null, e);
25573        closeArray();
25574      };
25575      if (element.hasQuantity()) {
25576        composeSimpleQuantity("quantity", element.getQuantity());
25577      }
25578      if (element.hasUnitPrice()) {
25579        composeMoney("unitPrice", element.getUnitPrice());
25580      }
25581      if (element.hasFactorElement()) {
25582        composeDecimalCore("factor", element.getFactorElement(), false);
25583        composeDecimalExtras("factor", element.getFactorElement(), false);
25584      }
25585      if (element.hasNet()) {
25586        composeMoney("net", element.getNet());
25587      }
25588      if (element.hasUdi()) {
25589        openArray("udi");
25590        for (Reference e : element.getUdi()) 
25591          composeReference(null, e);
25592        closeArray();
25593      };
25594  }
25595
25596  protected void composeClaimResponse(String name, ClaimResponse element) throws IOException {
25597    if (element != null) {
25598      prop("resourceType", name);
25599      composeClaimResponseInner(element);
25600    }
25601  }
25602
25603  protected void composeClaimResponseInner(ClaimResponse element) throws IOException {
25604      composeDomainResourceElements(element);
25605      if (element.hasIdentifier()) {
25606        openArray("identifier");
25607        for (Identifier e : element.getIdentifier()) 
25608          composeIdentifier(null, e);
25609        closeArray();
25610      };
25611      if (element.hasStatusElement()) {
25612        composeEnumerationCore("status", element.getStatusElement(), new ClaimResponse.ClaimResponseStatusEnumFactory(), false);
25613        composeEnumerationExtras("status", element.getStatusElement(), new ClaimResponse.ClaimResponseStatusEnumFactory(), false);
25614      }
25615      if (element.hasPatient()) {
25616        composeReference("patient", element.getPatient());
25617      }
25618      if (element.hasCreatedElement()) {
25619        composeDateTimeCore("created", element.getCreatedElement(), false);
25620        composeDateTimeExtras("created", element.getCreatedElement(), false);
25621      }
25622      if (element.hasInsurer()) {
25623        composeReference("insurer", element.getInsurer());
25624      }
25625      if (element.hasRequestProvider()) {
25626        composeReference("requestProvider", element.getRequestProvider());
25627      }
25628      if (element.hasRequestOrganization()) {
25629        composeReference("requestOrganization", element.getRequestOrganization());
25630      }
25631      if (element.hasRequest()) {
25632        composeReference("request", element.getRequest());
25633      }
25634      if (element.hasOutcome()) {
25635        composeCodeableConcept("outcome", element.getOutcome());
25636      }
25637      if (element.hasDispositionElement()) {
25638        composeStringCore("disposition", element.getDispositionElement(), false);
25639        composeStringExtras("disposition", element.getDispositionElement(), false);
25640      }
25641      if (element.hasPayeeType()) {
25642        composeCodeableConcept("payeeType", element.getPayeeType());
25643      }
25644      if (element.hasItem()) {
25645        openArray("item");
25646        for (ClaimResponse.ItemComponent e : element.getItem()) 
25647          composeClaimResponseItemComponent(null, e);
25648        closeArray();
25649      };
25650      if (element.hasAddItem()) {
25651        openArray("addItem");
25652        for (ClaimResponse.AddedItemComponent e : element.getAddItem()) 
25653          composeClaimResponseAddedItemComponent(null, e);
25654        closeArray();
25655      };
25656      if (element.hasError()) {
25657        openArray("error");
25658        for (ClaimResponse.ErrorComponent e : element.getError()) 
25659          composeClaimResponseErrorComponent(null, e);
25660        closeArray();
25661      };
25662      if (element.hasTotalCost()) {
25663        composeMoney("totalCost", element.getTotalCost());
25664      }
25665      if (element.hasUnallocDeductable()) {
25666        composeMoney("unallocDeductable", element.getUnallocDeductable());
25667      }
25668      if (element.hasTotalBenefit()) {
25669        composeMoney("totalBenefit", element.getTotalBenefit());
25670      }
25671      if (element.hasPayment()) {
25672        composeClaimResponsePaymentComponent("payment", element.getPayment());
25673      }
25674      if (element.hasReserved()) {
25675        composeCoding("reserved", element.getReserved());
25676      }
25677      if (element.hasForm()) {
25678        composeCodeableConcept("form", element.getForm());
25679      }
25680      if (element.hasProcessNote()) {
25681        openArray("processNote");
25682        for (ClaimResponse.NoteComponent e : element.getProcessNote()) 
25683          composeClaimResponseNoteComponent(null, e);
25684        closeArray();
25685      };
25686      if (element.hasCommunicationRequest()) {
25687        openArray("communicationRequest");
25688        for (Reference e : element.getCommunicationRequest()) 
25689          composeReference(null, e);
25690        closeArray();
25691      };
25692      if (element.hasInsurance()) {
25693        openArray("insurance");
25694        for (ClaimResponse.InsuranceComponent e : element.getInsurance()) 
25695          composeClaimResponseInsuranceComponent(null, e);
25696        closeArray();
25697      };
25698  }
25699
25700  protected void composeClaimResponseItemComponent(String name, ClaimResponse.ItemComponent element) throws IOException {
25701    if (element != null) {
25702      open(name);
25703      composeClaimResponseItemComponentInner(element);
25704      close();
25705    }
25706  }
25707
25708  protected void composeClaimResponseItemComponentInner(ClaimResponse.ItemComponent element) throws IOException {
25709      composeBackbone(element);
25710      if (element.hasSequenceLinkIdElement()) {
25711        composePositiveIntCore("sequenceLinkId", element.getSequenceLinkIdElement(), false);
25712        composePositiveIntExtras("sequenceLinkId", element.getSequenceLinkIdElement(), false);
25713      }
25714      if (element.hasNoteNumber()) {
25715        openArray("noteNumber");
25716        for (PositiveIntType e : element.getNoteNumber()) 
25717          composePositiveIntCore(null, e, true);
25718        closeArray();
25719        if (anyHasExtras(element.getNoteNumber())) {
25720          openArray("_noteNumber");
25721          for (PositiveIntType e : element.getNoteNumber()) 
25722            composePositiveIntExtras(null, e, true);
25723          closeArray();
25724        }
25725      };
25726      if (element.hasAdjudication()) {
25727        openArray("adjudication");
25728        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
25729          composeClaimResponseAdjudicationComponent(null, e);
25730        closeArray();
25731      };
25732      if (element.hasDetail()) {
25733        openArray("detail");
25734        for (ClaimResponse.ItemDetailComponent e : element.getDetail()) 
25735          composeClaimResponseItemDetailComponent(null, e);
25736        closeArray();
25737      };
25738  }
25739
25740  protected void composeClaimResponseAdjudicationComponent(String name, ClaimResponse.AdjudicationComponent element) throws IOException {
25741    if (element != null) {
25742      open(name);
25743      composeClaimResponseAdjudicationComponentInner(element);
25744      close();
25745    }
25746  }
25747
25748  protected void composeClaimResponseAdjudicationComponentInner(ClaimResponse.AdjudicationComponent element) throws IOException {
25749      composeBackbone(element);
25750      if (element.hasCategory()) {
25751        composeCodeableConcept("category", element.getCategory());
25752      }
25753      if (element.hasReason()) {
25754        composeCodeableConcept("reason", element.getReason());
25755      }
25756      if (element.hasAmount()) {
25757        composeMoney("amount", element.getAmount());
25758      }
25759      if (element.hasValueElement()) {
25760        composeDecimalCore("value", element.getValueElement(), false);
25761        composeDecimalExtras("value", element.getValueElement(), false);
25762      }
25763  }
25764
25765  protected void composeClaimResponseItemDetailComponent(String name, ClaimResponse.ItemDetailComponent element) throws IOException {
25766    if (element != null) {
25767      open(name);
25768      composeClaimResponseItemDetailComponentInner(element);
25769      close();
25770    }
25771  }
25772
25773  protected void composeClaimResponseItemDetailComponentInner(ClaimResponse.ItemDetailComponent element) throws IOException {
25774      composeBackbone(element);
25775      if (element.hasSequenceLinkIdElement()) {
25776        composePositiveIntCore("sequenceLinkId", element.getSequenceLinkIdElement(), false);
25777        composePositiveIntExtras("sequenceLinkId", element.getSequenceLinkIdElement(), false);
25778      }
25779      if (element.hasNoteNumber()) {
25780        openArray("noteNumber");
25781        for (PositiveIntType e : element.getNoteNumber()) 
25782          composePositiveIntCore(null, e, true);
25783        closeArray();
25784        if (anyHasExtras(element.getNoteNumber())) {
25785          openArray("_noteNumber");
25786          for (PositiveIntType e : element.getNoteNumber()) 
25787            composePositiveIntExtras(null, e, true);
25788          closeArray();
25789        }
25790      };
25791      if (element.hasAdjudication()) {
25792        openArray("adjudication");
25793        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
25794          composeClaimResponseAdjudicationComponent(null, e);
25795        closeArray();
25796      };
25797      if (element.hasSubDetail()) {
25798        openArray("subDetail");
25799        for (ClaimResponse.SubDetailComponent e : element.getSubDetail()) 
25800          composeClaimResponseSubDetailComponent(null, e);
25801        closeArray();
25802      };
25803  }
25804
25805  protected void composeClaimResponseSubDetailComponent(String name, ClaimResponse.SubDetailComponent element) throws IOException {
25806    if (element != null) {
25807      open(name);
25808      composeClaimResponseSubDetailComponentInner(element);
25809      close();
25810    }
25811  }
25812
25813  protected void composeClaimResponseSubDetailComponentInner(ClaimResponse.SubDetailComponent element) throws IOException {
25814      composeBackbone(element);
25815      if (element.hasSequenceLinkIdElement()) {
25816        composePositiveIntCore("sequenceLinkId", element.getSequenceLinkIdElement(), false);
25817        composePositiveIntExtras("sequenceLinkId", element.getSequenceLinkIdElement(), false);
25818      }
25819      if (element.hasNoteNumber()) {
25820        openArray("noteNumber");
25821        for (PositiveIntType e : element.getNoteNumber()) 
25822          composePositiveIntCore(null, e, true);
25823        closeArray();
25824        if (anyHasExtras(element.getNoteNumber())) {
25825          openArray("_noteNumber");
25826          for (PositiveIntType e : element.getNoteNumber()) 
25827            composePositiveIntExtras(null, e, true);
25828          closeArray();
25829        }
25830      };
25831      if (element.hasAdjudication()) {
25832        openArray("adjudication");
25833        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
25834          composeClaimResponseAdjudicationComponent(null, e);
25835        closeArray();
25836      };
25837  }
25838
25839  protected void composeClaimResponseAddedItemComponent(String name, ClaimResponse.AddedItemComponent element) throws IOException {
25840    if (element != null) {
25841      open(name);
25842      composeClaimResponseAddedItemComponentInner(element);
25843      close();
25844    }
25845  }
25846
25847  protected void composeClaimResponseAddedItemComponentInner(ClaimResponse.AddedItemComponent element) throws IOException {
25848      composeBackbone(element);
25849      if (element.hasSequenceLinkId()) {
25850        openArray("sequenceLinkId");
25851        for (PositiveIntType e : element.getSequenceLinkId()) 
25852          composePositiveIntCore(null, e, true);
25853        closeArray();
25854        if (anyHasExtras(element.getSequenceLinkId())) {
25855          openArray("_sequenceLinkId");
25856          for (PositiveIntType e : element.getSequenceLinkId()) 
25857            composePositiveIntExtras(null, e, true);
25858          closeArray();
25859        }
25860      };
25861      if (element.hasRevenue()) {
25862        composeCodeableConcept("revenue", element.getRevenue());
25863      }
25864      if (element.hasCategory()) {
25865        composeCodeableConcept("category", element.getCategory());
25866      }
25867      if (element.hasService()) {
25868        composeCodeableConcept("service", element.getService());
25869      }
25870      if (element.hasModifier()) {
25871        openArray("modifier");
25872        for (CodeableConcept e : element.getModifier()) 
25873          composeCodeableConcept(null, e);
25874        closeArray();
25875      };
25876      if (element.hasFee()) {
25877        composeMoney("fee", element.getFee());
25878      }
25879      if (element.hasNoteNumber()) {
25880        openArray("noteNumber");
25881        for (PositiveIntType e : element.getNoteNumber()) 
25882          composePositiveIntCore(null, e, true);
25883        closeArray();
25884        if (anyHasExtras(element.getNoteNumber())) {
25885          openArray("_noteNumber");
25886          for (PositiveIntType e : element.getNoteNumber()) 
25887            composePositiveIntExtras(null, e, true);
25888          closeArray();
25889        }
25890      };
25891      if (element.hasAdjudication()) {
25892        openArray("adjudication");
25893        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
25894          composeClaimResponseAdjudicationComponent(null, e);
25895        closeArray();
25896      };
25897      if (element.hasDetail()) {
25898        openArray("detail");
25899        for (ClaimResponse.AddedItemsDetailComponent e : element.getDetail()) 
25900          composeClaimResponseAddedItemsDetailComponent(null, e);
25901        closeArray();
25902      };
25903  }
25904
25905  protected void composeClaimResponseAddedItemsDetailComponent(String name, ClaimResponse.AddedItemsDetailComponent element) throws IOException {
25906    if (element != null) {
25907      open(name);
25908      composeClaimResponseAddedItemsDetailComponentInner(element);
25909      close();
25910    }
25911  }
25912
25913  protected void composeClaimResponseAddedItemsDetailComponentInner(ClaimResponse.AddedItemsDetailComponent element) throws IOException {
25914      composeBackbone(element);
25915      if (element.hasRevenue()) {
25916        composeCodeableConcept("revenue", element.getRevenue());
25917      }
25918      if (element.hasCategory()) {
25919        composeCodeableConcept("category", element.getCategory());
25920      }
25921      if (element.hasService()) {
25922        composeCodeableConcept("service", element.getService());
25923      }
25924      if (element.hasModifier()) {
25925        openArray("modifier");
25926        for (CodeableConcept e : element.getModifier()) 
25927          composeCodeableConcept(null, e);
25928        closeArray();
25929      };
25930      if (element.hasFee()) {
25931        composeMoney("fee", element.getFee());
25932      }
25933      if (element.hasNoteNumber()) {
25934        openArray("noteNumber");
25935        for (PositiveIntType e : element.getNoteNumber()) 
25936          composePositiveIntCore(null, e, true);
25937        closeArray();
25938        if (anyHasExtras(element.getNoteNumber())) {
25939          openArray("_noteNumber");
25940          for (PositiveIntType e : element.getNoteNumber()) 
25941            composePositiveIntExtras(null, e, true);
25942          closeArray();
25943        }
25944      };
25945      if (element.hasAdjudication()) {
25946        openArray("adjudication");
25947        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
25948          composeClaimResponseAdjudicationComponent(null, e);
25949        closeArray();
25950      };
25951  }
25952
25953  protected void composeClaimResponseErrorComponent(String name, ClaimResponse.ErrorComponent element) throws IOException {
25954    if (element != null) {
25955      open(name);
25956      composeClaimResponseErrorComponentInner(element);
25957      close();
25958    }
25959  }
25960
25961  protected void composeClaimResponseErrorComponentInner(ClaimResponse.ErrorComponent element) throws IOException {
25962      composeBackbone(element);
25963      if (element.hasSequenceLinkIdElement()) {
25964        composePositiveIntCore("sequenceLinkId", element.getSequenceLinkIdElement(), false);
25965        composePositiveIntExtras("sequenceLinkId", element.getSequenceLinkIdElement(), false);
25966      }
25967      if (element.hasDetailSequenceLinkIdElement()) {
25968        composePositiveIntCore("detailSequenceLinkId", element.getDetailSequenceLinkIdElement(), false);
25969        composePositiveIntExtras("detailSequenceLinkId", element.getDetailSequenceLinkIdElement(), false);
25970      }
25971      if (element.hasSubdetailSequenceLinkIdElement()) {
25972        composePositiveIntCore("subdetailSequenceLinkId", element.getSubdetailSequenceLinkIdElement(), false);
25973        composePositiveIntExtras("subdetailSequenceLinkId", element.getSubdetailSequenceLinkIdElement(), false);
25974      }
25975      if (element.hasCode()) {
25976        composeCodeableConcept("code", element.getCode());
25977      }
25978  }
25979
25980  protected void composeClaimResponsePaymentComponent(String name, ClaimResponse.PaymentComponent element) throws IOException {
25981    if (element != null) {
25982      open(name);
25983      composeClaimResponsePaymentComponentInner(element);
25984      close();
25985    }
25986  }
25987
25988  protected void composeClaimResponsePaymentComponentInner(ClaimResponse.PaymentComponent element) throws IOException {
25989      composeBackbone(element);
25990      if (element.hasType()) {
25991        composeCodeableConcept("type", element.getType());
25992      }
25993      if (element.hasAdjustment()) {
25994        composeMoney("adjustment", element.getAdjustment());
25995      }
25996      if (element.hasAdjustmentReason()) {
25997        composeCodeableConcept("adjustmentReason", element.getAdjustmentReason());
25998      }
25999      if (element.hasDateElement()) {
26000        composeDateCore("date", element.getDateElement(), false);
26001        composeDateExtras("date", element.getDateElement(), false);
26002      }
26003      if (element.hasAmount()) {
26004        composeMoney("amount", element.getAmount());
26005      }
26006      if (element.hasIdentifier()) {
26007        composeIdentifier("identifier", element.getIdentifier());
26008      }
26009  }
26010
26011  protected void composeClaimResponseNoteComponent(String name, ClaimResponse.NoteComponent element) throws IOException {
26012    if (element != null) {
26013      open(name);
26014      composeClaimResponseNoteComponentInner(element);
26015      close();
26016    }
26017  }
26018
26019  protected void composeClaimResponseNoteComponentInner(ClaimResponse.NoteComponent element) throws IOException {
26020      composeBackbone(element);
26021      if (element.hasNumberElement()) {
26022        composePositiveIntCore("number", element.getNumberElement(), false);
26023        composePositiveIntExtras("number", element.getNumberElement(), false);
26024      }
26025      if (element.hasType()) {
26026        composeCodeableConcept("type", element.getType());
26027      }
26028      if (element.hasTextElement()) {
26029        composeStringCore("text", element.getTextElement(), false);
26030        composeStringExtras("text", element.getTextElement(), false);
26031      }
26032      if (element.hasLanguage()) {
26033        composeCodeableConcept("language", element.getLanguage());
26034      }
26035  }
26036
26037  protected void composeClaimResponseInsuranceComponent(String name, ClaimResponse.InsuranceComponent element) throws IOException {
26038    if (element != null) {
26039      open(name);
26040      composeClaimResponseInsuranceComponentInner(element);
26041      close();
26042    }
26043  }
26044
26045  protected void composeClaimResponseInsuranceComponentInner(ClaimResponse.InsuranceComponent element) throws IOException {
26046      composeBackbone(element);
26047      if (element.hasSequenceElement()) {
26048        composePositiveIntCore("sequence", element.getSequenceElement(), false);
26049        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
26050      }
26051      if (element.hasFocalElement()) {
26052        composeBooleanCore("focal", element.getFocalElement(), false);
26053        composeBooleanExtras("focal", element.getFocalElement(), false);
26054      }
26055      if (element.hasCoverage()) {
26056        composeReference("coverage", element.getCoverage());
26057      }
26058      if (element.hasBusinessArrangementElement()) {
26059        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
26060        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
26061      }
26062      if (element.hasPreAuthRef()) {
26063        openArray("preAuthRef");
26064        for (StringType e : element.getPreAuthRef()) 
26065          composeStringCore(null, e, true);
26066        closeArray();
26067        if (anyHasExtras(element.getPreAuthRef())) {
26068          openArray("_preAuthRef");
26069          for (StringType e : element.getPreAuthRef()) 
26070            composeStringExtras(null, e, true);
26071          closeArray();
26072        }
26073      };
26074      if (element.hasClaimResponse()) {
26075        composeReference("claimResponse", element.getClaimResponse());
26076      }
26077  }
26078
26079  protected void composeClinicalImpression(String name, ClinicalImpression element) throws IOException {
26080    if (element != null) {
26081      prop("resourceType", name);
26082      composeClinicalImpressionInner(element);
26083    }
26084  }
26085
26086  protected void composeClinicalImpressionInner(ClinicalImpression element) throws IOException {
26087      composeDomainResourceElements(element);
26088      if (element.hasIdentifier()) {
26089        openArray("identifier");
26090        for (Identifier e : element.getIdentifier()) 
26091          composeIdentifier(null, e);
26092        closeArray();
26093      };
26094      if (element.hasStatusElement()) {
26095        composeEnumerationCore("status", element.getStatusElement(), new ClinicalImpression.ClinicalImpressionStatusEnumFactory(), false);
26096        composeEnumerationExtras("status", element.getStatusElement(), new ClinicalImpression.ClinicalImpressionStatusEnumFactory(), false);
26097      }
26098      if (element.hasCode()) {
26099        composeCodeableConcept("code", element.getCode());
26100      }
26101      if (element.hasDescriptionElement()) {
26102        composeStringCore("description", element.getDescriptionElement(), false);
26103        composeStringExtras("description", element.getDescriptionElement(), false);
26104      }
26105      if (element.hasSubject()) {
26106        composeReference("subject", element.getSubject());
26107      }
26108      if (element.hasContext()) {
26109        composeReference("context", element.getContext());
26110      }
26111      if (element.hasEffective()) {
26112        composeType("effective", element.getEffective());
26113      }
26114      if (element.hasDateElement()) {
26115        composeDateTimeCore("date", element.getDateElement(), false);
26116        composeDateTimeExtras("date", element.getDateElement(), false);
26117      }
26118      if (element.hasAssessor()) {
26119        composeReference("assessor", element.getAssessor());
26120      }
26121      if (element.hasPrevious()) {
26122        composeReference("previous", element.getPrevious());
26123      }
26124      if (element.hasProblem()) {
26125        openArray("problem");
26126        for (Reference e : element.getProblem()) 
26127          composeReference(null, e);
26128        closeArray();
26129      };
26130      if (element.hasInvestigation()) {
26131        openArray("investigation");
26132        for (ClinicalImpression.ClinicalImpressionInvestigationComponent e : element.getInvestigation()) 
26133          composeClinicalImpressionClinicalImpressionInvestigationComponent(null, e);
26134        closeArray();
26135      };
26136      if (element.hasProtocol()) {
26137        openArray("protocol");
26138        for (UriType e : element.getProtocol()) 
26139          composeUriCore(null, e, true);
26140        closeArray();
26141        if (anyHasExtras(element.getProtocol())) {
26142          openArray("_protocol");
26143          for (UriType e : element.getProtocol()) 
26144            composeUriExtras(null, e, true);
26145          closeArray();
26146        }
26147      };
26148      if (element.hasSummaryElement()) {
26149        composeStringCore("summary", element.getSummaryElement(), false);
26150        composeStringExtras("summary", element.getSummaryElement(), false);
26151      }
26152      if (element.hasFinding()) {
26153        openArray("finding");
26154        for (ClinicalImpression.ClinicalImpressionFindingComponent e : element.getFinding()) 
26155          composeClinicalImpressionClinicalImpressionFindingComponent(null, e);
26156        closeArray();
26157      };
26158      if (element.hasPrognosisCodeableConcept()) {
26159        openArray("prognosisCodeableConcept");
26160        for (CodeableConcept e : element.getPrognosisCodeableConcept()) 
26161          composeCodeableConcept(null, e);
26162        closeArray();
26163      };
26164      if (element.hasPrognosisReference()) {
26165        openArray("prognosisReference");
26166        for (Reference e : element.getPrognosisReference()) 
26167          composeReference(null, e);
26168        closeArray();
26169      };
26170      if (element.hasAction()) {
26171        openArray("action");
26172        for (Reference e : element.getAction()) 
26173          composeReference(null, e);
26174        closeArray();
26175      };
26176      if (element.hasNote()) {
26177        openArray("note");
26178        for (Annotation e : element.getNote()) 
26179          composeAnnotation(null, e);
26180        closeArray();
26181      };
26182  }
26183
26184  protected void composeClinicalImpressionClinicalImpressionInvestigationComponent(String name, ClinicalImpression.ClinicalImpressionInvestigationComponent element) throws IOException {
26185    if (element != null) {
26186      open(name);
26187      composeClinicalImpressionClinicalImpressionInvestigationComponentInner(element);
26188      close();
26189    }
26190  }
26191
26192  protected void composeClinicalImpressionClinicalImpressionInvestigationComponentInner(ClinicalImpression.ClinicalImpressionInvestigationComponent element) throws IOException {
26193      composeBackbone(element);
26194      if (element.hasCode()) {
26195        composeCodeableConcept("code", element.getCode());
26196      }
26197      if (element.hasItem()) {
26198        openArray("item");
26199        for (Reference e : element.getItem()) 
26200          composeReference(null, e);
26201        closeArray();
26202      };
26203  }
26204
26205  protected void composeClinicalImpressionClinicalImpressionFindingComponent(String name, ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
26206    if (element != null) {
26207      open(name);
26208      composeClinicalImpressionClinicalImpressionFindingComponentInner(element);
26209      close();
26210    }
26211  }
26212
26213  protected void composeClinicalImpressionClinicalImpressionFindingComponentInner(ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
26214      composeBackbone(element);
26215      if (element.hasItem()) {
26216        composeType("item", element.getItem());
26217      }
26218      if (element.hasBasisElement()) {
26219        composeStringCore("basis", element.getBasisElement(), false);
26220        composeStringExtras("basis", element.getBasisElement(), false);
26221      }
26222  }
26223
26224  protected void composeCodeSystem(String name, CodeSystem element) throws IOException {
26225    if (element != null) {
26226      prop("resourceType", name);
26227      composeCodeSystemInner(element);
26228    }
26229  }
26230
26231  protected void composeCodeSystemInner(CodeSystem element) throws IOException {
26232      composeDomainResourceElements(element);
26233      if (element.hasUrlElement()) {
26234        composeUriCore("url", element.getUrlElement(), false);
26235        composeUriExtras("url", element.getUrlElement(), false);
26236      }
26237      if (element.hasIdentifier()) {
26238        composeIdentifier("identifier", element.getIdentifier());
26239      }
26240      if (element.hasVersionElement()) {
26241        composeStringCore("version", element.getVersionElement(), false);
26242        composeStringExtras("version", element.getVersionElement(), false);
26243      }
26244      if (element.hasNameElement()) {
26245        composeStringCore("name", element.getNameElement(), false);
26246        composeStringExtras("name", element.getNameElement(), false);
26247      }
26248      if (element.hasTitleElement()) {
26249        composeStringCore("title", element.getTitleElement(), false);
26250        composeStringExtras("title", element.getTitleElement(), false);
26251      }
26252      if (element.hasStatusElement()) {
26253        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
26254        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
26255      }
26256      if (element.hasExperimentalElement()) {
26257        composeBooleanCore("experimental", element.getExperimentalElement(), false);
26258        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
26259      }
26260      if (element.hasDateElement()) {
26261        composeDateTimeCore("date", element.getDateElement(), false);
26262        composeDateTimeExtras("date", element.getDateElement(), false);
26263      }
26264      if (element.hasPublisherElement()) {
26265        composeStringCore("publisher", element.getPublisherElement(), false);
26266        composeStringExtras("publisher", element.getPublisherElement(), false);
26267      }
26268      if (element.hasContact()) {
26269        openArray("contact");
26270        for (ContactDetail e : element.getContact()) 
26271          composeContactDetail(null, e);
26272        closeArray();
26273      };
26274      if (element.hasDescriptionElement()) {
26275        composeMarkdownCore("description", element.getDescriptionElement(), false);
26276        composeMarkdownExtras("description", element.getDescriptionElement(), false);
26277      }
26278      if (element.hasUseContext()) {
26279        openArray("useContext");
26280        for (UsageContext e : element.getUseContext()) 
26281          composeUsageContext(null, e);
26282        closeArray();
26283      };
26284      if (element.hasJurisdiction()) {
26285        openArray("jurisdiction");
26286        for (CodeableConcept e : element.getJurisdiction()) 
26287          composeCodeableConcept(null, e);
26288        closeArray();
26289      };
26290      if (element.hasPurposeElement()) {
26291        composeMarkdownCore("purpose", element.getPurposeElement(), false);
26292        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
26293      }
26294      if (element.hasCopyrightElement()) {
26295        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
26296        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
26297      }
26298      if (element.hasCaseSensitiveElement()) {
26299        composeBooleanCore("caseSensitive", element.getCaseSensitiveElement(), false);
26300        composeBooleanExtras("caseSensitive", element.getCaseSensitiveElement(), false);
26301      }
26302      if (element.hasValueSetElement()) {
26303        composeUriCore("valueSet", element.getValueSetElement(), false);
26304        composeUriExtras("valueSet", element.getValueSetElement(), false);
26305      }
26306      if (element.hasHierarchyMeaningElement()) {
26307        composeEnumerationCore("hierarchyMeaning", element.getHierarchyMeaningElement(), new CodeSystem.CodeSystemHierarchyMeaningEnumFactory(), false);
26308        composeEnumerationExtras("hierarchyMeaning", element.getHierarchyMeaningElement(), new CodeSystem.CodeSystemHierarchyMeaningEnumFactory(), false);
26309      }
26310      if (element.hasCompositionalElement()) {
26311        composeBooleanCore("compositional", element.getCompositionalElement(), false);
26312        composeBooleanExtras("compositional", element.getCompositionalElement(), false);
26313      }
26314      if (element.hasVersionNeededElement()) {
26315        composeBooleanCore("versionNeeded", element.getVersionNeededElement(), false);
26316        composeBooleanExtras("versionNeeded", element.getVersionNeededElement(), false);
26317      }
26318      if (element.hasContentElement()) {
26319        composeEnumerationCore("content", element.getContentElement(), new CodeSystem.CodeSystemContentModeEnumFactory(), false);
26320        composeEnumerationExtras("content", element.getContentElement(), new CodeSystem.CodeSystemContentModeEnumFactory(), false);
26321      }
26322      if (element.hasCountElement()) {
26323        composeUnsignedIntCore("count", element.getCountElement(), false);
26324        composeUnsignedIntExtras("count", element.getCountElement(), false);
26325      }
26326      if (element.hasFilter()) {
26327        openArray("filter");
26328        for (CodeSystem.CodeSystemFilterComponent e : element.getFilter()) 
26329          composeCodeSystemCodeSystemFilterComponent(null, e);
26330        closeArray();
26331      };
26332      if (element.hasProperty()) {
26333        openArray("property");
26334        for (CodeSystem.PropertyComponent e : element.getProperty()) 
26335          composeCodeSystemPropertyComponent(null, e);
26336        closeArray();
26337      };
26338      if (element.hasConcept()) {
26339        openArray("concept");
26340        for (CodeSystem.ConceptDefinitionComponent e : element.getConcept()) 
26341          composeCodeSystemConceptDefinitionComponent(null, e);
26342        closeArray();
26343      };
26344  }
26345
26346  protected void composeCodeSystemCodeSystemFilterComponent(String name, CodeSystem.CodeSystemFilterComponent element) throws IOException {
26347    if (element != null) {
26348      open(name);
26349      composeCodeSystemCodeSystemFilterComponentInner(element);
26350      close();
26351    }
26352  }
26353
26354  protected void composeCodeSystemCodeSystemFilterComponentInner(CodeSystem.CodeSystemFilterComponent element) throws IOException {
26355      composeBackbone(element);
26356      if (element.hasCodeElement()) {
26357        composeCodeCore("code", element.getCodeElement(), false);
26358        composeCodeExtras("code", element.getCodeElement(), false);
26359      }
26360      if (element.hasDescriptionElement()) {
26361        composeStringCore("description", element.getDescriptionElement(), false);
26362        composeStringExtras("description", element.getDescriptionElement(), false);
26363      }
26364      if (element.hasOperator()) {
26365        openArray("operator");
26366        for (Enumeration<CodeSystem.FilterOperator> e : element.getOperator()) 
26367          composeEnumerationCore(null, e, new CodeSystem.FilterOperatorEnumFactory(), true);
26368        closeArray();
26369        if (anyHasExtras(element.getOperator())) {
26370          openArray("_operator");
26371          for (Enumeration<CodeSystem.FilterOperator> e : element.getOperator()) 
26372            composeEnumerationExtras(null, e, new CodeSystem.FilterOperatorEnumFactory(), true);
26373          closeArray();
26374        }
26375      };
26376      if (element.hasValueElement()) {
26377        composeStringCore("value", element.getValueElement(), false);
26378        composeStringExtras("value", element.getValueElement(), false);
26379      }
26380  }
26381
26382  protected void composeCodeSystemPropertyComponent(String name, CodeSystem.PropertyComponent element) throws IOException {
26383    if (element != null) {
26384      open(name);
26385      composeCodeSystemPropertyComponentInner(element);
26386      close();
26387    }
26388  }
26389
26390  protected void composeCodeSystemPropertyComponentInner(CodeSystem.PropertyComponent element) throws IOException {
26391      composeBackbone(element);
26392      if (element.hasCodeElement()) {
26393        composeCodeCore("code", element.getCodeElement(), false);
26394        composeCodeExtras("code", element.getCodeElement(), false);
26395      }
26396      if (element.hasUriElement()) {
26397        composeUriCore("uri", element.getUriElement(), false);
26398        composeUriExtras("uri", element.getUriElement(), false);
26399      }
26400      if (element.hasDescriptionElement()) {
26401        composeStringCore("description", element.getDescriptionElement(), false);
26402        composeStringExtras("description", element.getDescriptionElement(), false);
26403      }
26404      if (element.hasTypeElement()) {
26405        composeEnumerationCore("type", element.getTypeElement(), new CodeSystem.PropertyTypeEnumFactory(), false);
26406        composeEnumerationExtras("type", element.getTypeElement(), new CodeSystem.PropertyTypeEnumFactory(), false);
26407      }
26408  }
26409
26410  protected void composeCodeSystemConceptDefinitionComponent(String name, CodeSystem.ConceptDefinitionComponent element) throws IOException {
26411    if (element != null) {
26412      open(name);
26413      composeCodeSystemConceptDefinitionComponentInner(element);
26414      close();
26415    }
26416  }
26417
26418  protected void composeCodeSystemConceptDefinitionComponentInner(CodeSystem.ConceptDefinitionComponent element) throws IOException {
26419      composeBackbone(element);
26420      if (element.hasCodeElement()) {
26421        composeCodeCore("code", element.getCodeElement(), false);
26422        composeCodeExtras("code", element.getCodeElement(), false);
26423      }
26424      if (element.hasDisplayElement()) {
26425        composeStringCore("display", element.getDisplayElement(), false);
26426        composeStringExtras("display", element.getDisplayElement(), false);
26427      }
26428      if (element.hasDefinitionElement()) {
26429        composeStringCore("definition", element.getDefinitionElement(), false);
26430        composeStringExtras("definition", element.getDefinitionElement(), false);
26431      }
26432      if (element.hasDesignation()) {
26433        openArray("designation");
26434        for (CodeSystem.ConceptDefinitionDesignationComponent e : element.getDesignation()) 
26435          composeCodeSystemConceptDefinitionDesignationComponent(null, e);
26436        closeArray();
26437      };
26438      if (element.hasProperty()) {
26439        openArray("property");
26440        for (CodeSystem.ConceptPropertyComponent e : element.getProperty()) 
26441          composeCodeSystemConceptPropertyComponent(null, e);
26442        closeArray();
26443      };
26444      if (element.hasConcept()) {
26445        openArray("concept");
26446        for (CodeSystem.ConceptDefinitionComponent e : element.getConcept()) 
26447          composeCodeSystemConceptDefinitionComponent(null, e);
26448        closeArray();
26449      };
26450  }
26451
26452  protected void composeCodeSystemConceptDefinitionDesignationComponent(String name, CodeSystem.ConceptDefinitionDesignationComponent element) throws IOException {
26453    if (element != null) {
26454      open(name);
26455      composeCodeSystemConceptDefinitionDesignationComponentInner(element);
26456      close();
26457    }
26458  }
26459
26460  protected void composeCodeSystemConceptDefinitionDesignationComponentInner(CodeSystem.ConceptDefinitionDesignationComponent element) throws IOException {
26461      composeBackbone(element);
26462      if (element.hasLanguageElement()) {
26463        composeCodeCore("language", element.getLanguageElement(), false);
26464        composeCodeExtras("language", element.getLanguageElement(), false);
26465      }
26466      if (element.hasUse()) {
26467        composeCoding("use", element.getUse());
26468      }
26469      if (element.hasValueElement()) {
26470        composeStringCore("value", element.getValueElement(), false);
26471        composeStringExtras("value", element.getValueElement(), false);
26472      }
26473  }
26474
26475  protected void composeCodeSystemConceptPropertyComponent(String name, CodeSystem.ConceptPropertyComponent element) throws IOException {
26476    if (element != null) {
26477      open(name);
26478      composeCodeSystemConceptPropertyComponentInner(element);
26479      close();
26480    }
26481  }
26482
26483  protected void composeCodeSystemConceptPropertyComponentInner(CodeSystem.ConceptPropertyComponent element) throws IOException {
26484      composeBackbone(element);
26485      if (element.hasCodeElement()) {
26486        composeCodeCore("code", element.getCodeElement(), false);
26487        composeCodeExtras("code", element.getCodeElement(), false);
26488      }
26489      if (element.hasValue()) {
26490        composeType("value", element.getValue());
26491      }
26492  }
26493
26494  protected void composeCommunication(String name, Communication element) throws IOException {
26495    if (element != null) {
26496      prop("resourceType", name);
26497      composeCommunicationInner(element);
26498    }
26499  }
26500
26501  protected void composeCommunicationInner(Communication element) throws IOException {
26502      composeDomainResourceElements(element);
26503      if (element.hasIdentifier()) {
26504        openArray("identifier");
26505        for (Identifier e : element.getIdentifier()) 
26506          composeIdentifier(null, e);
26507        closeArray();
26508      };
26509      if (element.hasDefinition()) {
26510        openArray("definition");
26511        for (Reference e : element.getDefinition()) 
26512          composeReference(null, e);
26513        closeArray();
26514      };
26515      if (element.hasBasedOn()) {
26516        openArray("basedOn");
26517        for (Reference e : element.getBasedOn()) 
26518          composeReference(null, e);
26519        closeArray();
26520      };
26521      if (element.hasPartOf()) {
26522        openArray("partOf");
26523        for (Reference e : element.getPartOf()) 
26524          composeReference(null, e);
26525        closeArray();
26526      };
26527      if (element.hasStatusElement()) {
26528        composeEnumerationCore("status", element.getStatusElement(), new Communication.CommunicationStatusEnumFactory(), false);
26529        composeEnumerationExtras("status", element.getStatusElement(), new Communication.CommunicationStatusEnumFactory(), false);
26530      }
26531      if (element.hasNotDoneElement()) {
26532        composeBooleanCore("notDone", element.getNotDoneElement(), false);
26533        composeBooleanExtras("notDone", element.getNotDoneElement(), false);
26534      }
26535      if (element.hasNotDoneReason()) {
26536        composeCodeableConcept("notDoneReason", element.getNotDoneReason());
26537      }
26538      if (element.hasCategory()) {
26539        openArray("category");
26540        for (CodeableConcept e : element.getCategory()) 
26541          composeCodeableConcept(null, e);
26542        closeArray();
26543      };
26544      if (element.hasMedium()) {
26545        openArray("medium");
26546        for (CodeableConcept e : element.getMedium()) 
26547          composeCodeableConcept(null, e);
26548        closeArray();
26549      };
26550      if (element.hasSubject()) {
26551        composeReference("subject", element.getSubject());
26552      }
26553      if (element.hasRecipient()) {
26554        openArray("recipient");
26555        for (Reference e : element.getRecipient()) 
26556          composeReference(null, e);
26557        closeArray();
26558      };
26559      if (element.hasTopic()) {
26560        openArray("topic");
26561        for (Reference e : element.getTopic()) 
26562          composeReference(null, e);
26563        closeArray();
26564      };
26565      if (element.hasContext()) {
26566        composeReference("context", element.getContext());
26567      }
26568      if (element.hasSentElement()) {
26569        composeDateTimeCore("sent", element.getSentElement(), false);
26570        composeDateTimeExtras("sent", element.getSentElement(), false);
26571      }
26572      if (element.hasReceivedElement()) {
26573        composeDateTimeCore("received", element.getReceivedElement(), false);
26574        composeDateTimeExtras("received", element.getReceivedElement(), false);
26575      }
26576      if (element.hasSender()) {
26577        composeReference("sender", element.getSender());
26578      }
26579      if (element.hasReasonCode()) {
26580        openArray("reasonCode");
26581        for (CodeableConcept e : element.getReasonCode()) 
26582          composeCodeableConcept(null, e);
26583        closeArray();
26584      };
26585      if (element.hasReasonReference()) {
26586        openArray("reasonReference");
26587        for (Reference e : element.getReasonReference()) 
26588          composeReference(null, e);
26589        closeArray();
26590      };
26591      if (element.hasPayload()) {
26592        openArray("payload");
26593        for (Communication.CommunicationPayloadComponent e : element.getPayload()) 
26594          composeCommunicationCommunicationPayloadComponent(null, e);
26595        closeArray();
26596      };
26597      if (element.hasNote()) {
26598        openArray("note");
26599        for (Annotation e : element.getNote()) 
26600          composeAnnotation(null, e);
26601        closeArray();
26602      };
26603  }
26604
26605  protected void composeCommunicationCommunicationPayloadComponent(String name, Communication.CommunicationPayloadComponent element) throws IOException {
26606    if (element != null) {
26607      open(name);
26608      composeCommunicationCommunicationPayloadComponentInner(element);
26609      close();
26610    }
26611  }
26612
26613  protected void composeCommunicationCommunicationPayloadComponentInner(Communication.CommunicationPayloadComponent element) throws IOException {
26614      composeBackbone(element);
26615      if (element.hasContent()) {
26616        composeType("content", element.getContent());
26617      }
26618  }
26619
26620  protected void composeCommunicationRequest(String name, CommunicationRequest element) throws IOException {
26621    if (element != null) {
26622      prop("resourceType", name);
26623      composeCommunicationRequestInner(element);
26624    }
26625  }
26626
26627  protected void composeCommunicationRequestInner(CommunicationRequest element) throws IOException {
26628      composeDomainResourceElements(element);
26629      if (element.hasIdentifier()) {
26630        openArray("identifier");
26631        for (Identifier e : element.getIdentifier()) 
26632          composeIdentifier(null, e);
26633        closeArray();
26634      };
26635      if (element.hasBasedOn()) {
26636        openArray("basedOn");
26637        for (Reference e : element.getBasedOn()) 
26638          composeReference(null, e);
26639        closeArray();
26640      };
26641      if (element.hasReplaces()) {
26642        openArray("replaces");
26643        for (Reference e : element.getReplaces()) 
26644          composeReference(null, e);
26645        closeArray();
26646      };
26647      if (element.hasGroupIdentifier()) {
26648        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
26649      }
26650      if (element.hasStatusElement()) {
26651        composeEnumerationCore("status", element.getStatusElement(), new CommunicationRequest.CommunicationRequestStatusEnumFactory(), false);
26652        composeEnumerationExtras("status", element.getStatusElement(), new CommunicationRequest.CommunicationRequestStatusEnumFactory(), false);
26653      }
26654      if (element.hasCategory()) {
26655        openArray("category");
26656        for (CodeableConcept e : element.getCategory()) 
26657          composeCodeableConcept(null, e);
26658        closeArray();
26659      };
26660      if (element.hasPriorityElement()) {
26661        composeEnumerationCore("priority", element.getPriorityElement(), new CommunicationRequest.CommunicationPriorityEnumFactory(), false);
26662        composeEnumerationExtras("priority", element.getPriorityElement(), new CommunicationRequest.CommunicationPriorityEnumFactory(), false);
26663      }
26664      if (element.hasMedium()) {
26665        openArray("medium");
26666        for (CodeableConcept e : element.getMedium()) 
26667          composeCodeableConcept(null, e);
26668        closeArray();
26669      };
26670      if (element.hasSubject()) {
26671        composeReference("subject", element.getSubject());
26672      }
26673      if (element.hasRecipient()) {
26674        openArray("recipient");
26675        for (Reference e : element.getRecipient()) 
26676          composeReference(null, e);
26677        closeArray();
26678      };
26679      if (element.hasTopic()) {
26680        openArray("topic");
26681        for (Reference e : element.getTopic()) 
26682          composeReference(null, e);
26683        closeArray();
26684      };
26685      if (element.hasContext()) {
26686        composeReference("context", element.getContext());
26687      }
26688      if (element.hasPayload()) {
26689        openArray("payload");
26690        for (CommunicationRequest.CommunicationRequestPayloadComponent e : element.getPayload()) 
26691          composeCommunicationRequestCommunicationRequestPayloadComponent(null, e);
26692        closeArray();
26693      };
26694      if (element.hasOccurrence()) {
26695        composeType("occurrence", element.getOccurrence());
26696      }
26697      if (element.hasAuthoredOnElement()) {
26698        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
26699        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
26700      }
26701      if (element.hasSender()) {
26702        composeReference("sender", element.getSender());
26703      }
26704      if (element.hasRequester()) {
26705        composeCommunicationRequestCommunicationRequestRequesterComponent("requester", element.getRequester());
26706      }
26707      if (element.hasReasonCode()) {
26708        openArray("reasonCode");
26709        for (CodeableConcept e : element.getReasonCode()) 
26710          composeCodeableConcept(null, e);
26711        closeArray();
26712      };
26713      if (element.hasReasonReference()) {
26714        openArray("reasonReference");
26715        for (Reference e : element.getReasonReference()) 
26716          composeReference(null, e);
26717        closeArray();
26718      };
26719      if (element.hasNote()) {
26720        openArray("note");
26721        for (Annotation e : element.getNote()) 
26722          composeAnnotation(null, e);
26723        closeArray();
26724      };
26725  }
26726
26727  protected void composeCommunicationRequestCommunicationRequestPayloadComponent(String name, CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
26728    if (element != null) {
26729      open(name);
26730      composeCommunicationRequestCommunicationRequestPayloadComponentInner(element);
26731      close();
26732    }
26733  }
26734
26735  protected void composeCommunicationRequestCommunicationRequestPayloadComponentInner(CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
26736      composeBackbone(element);
26737      if (element.hasContent()) {
26738        composeType("content", element.getContent());
26739      }
26740  }
26741
26742  protected void composeCommunicationRequestCommunicationRequestRequesterComponent(String name, CommunicationRequest.CommunicationRequestRequesterComponent element) throws IOException {
26743    if (element != null) {
26744      open(name);
26745      composeCommunicationRequestCommunicationRequestRequesterComponentInner(element);
26746      close();
26747    }
26748  }
26749
26750  protected void composeCommunicationRequestCommunicationRequestRequesterComponentInner(CommunicationRequest.CommunicationRequestRequesterComponent element) throws IOException {
26751      composeBackbone(element);
26752      if (element.hasAgent()) {
26753        composeReference("agent", element.getAgent());
26754      }
26755      if (element.hasOnBehalfOf()) {
26756        composeReference("onBehalfOf", element.getOnBehalfOf());
26757      }
26758  }
26759
26760  protected void composeCompartmentDefinition(String name, CompartmentDefinition element) throws IOException {
26761    if (element != null) {
26762      prop("resourceType", name);
26763      composeCompartmentDefinitionInner(element);
26764    }
26765  }
26766
26767  protected void composeCompartmentDefinitionInner(CompartmentDefinition element) throws IOException {
26768      composeDomainResourceElements(element);
26769      if (element.hasUrlElement()) {
26770        composeUriCore("url", element.getUrlElement(), false);
26771        composeUriExtras("url", element.getUrlElement(), false);
26772      }
26773      if (element.hasNameElement()) {
26774        composeStringCore("name", element.getNameElement(), false);
26775        composeStringExtras("name", element.getNameElement(), false);
26776      }
26777      if (element.hasTitleElement()) {
26778        composeStringCore("title", element.getTitleElement(), false);
26779        composeStringExtras("title", element.getTitleElement(), false);
26780      }
26781      if (element.hasStatusElement()) {
26782        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
26783        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
26784      }
26785      if (element.hasExperimentalElement()) {
26786        composeBooleanCore("experimental", element.getExperimentalElement(), false);
26787        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
26788      }
26789      if (element.hasDateElement()) {
26790        composeDateTimeCore("date", element.getDateElement(), false);
26791        composeDateTimeExtras("date", element.getDateElement(), false);
26792      }
26793      if (element.hasPublisherElement()) {
26794        composeStringCore("publisher", element.getPublisherElement(), false);
26795        composeStringExtras("publisher", element.getPublisherElement(), false);
26796      }
26797      if (element.hasContact()) {
26798        openArray("contact");
26799        for (ContactDetail e : element.getContact()) 
26800          composeContactDetail(null, e);
26801        closeArray();
26802      };
26803      if (element.hasDescriptionElement()) {
26804        composeMarkdownCore("description", element.getDescriptionElement(), false);
26805        composeMarkdownExtras("description", element.getDescriptionElement(), false);
26806      }
26807      if (element.hasPurposeElement()) {
26808        composeMarkdownCore("purpose", element.getPurposeElement(), false);
26809        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
26810      }
26811      if (element.hasUseContext()) {
26812        openArray("useContext");
26813        for (UsageContext e : element.getUseContext()) 
26814          composeUsageContext(null, e);
26815        closeArray();
26816      };
26817      if (element.hasJurisdiction()) {
26818        openArray("jurisdiction");
26819        for (CodeableConcept e : element.getJurisdiction()) 
26820          composeCodeableConcept(null, e);
26821        closeArray();
26822      };
26823      if (element.hasCodeElement()) {
26824        composeEnumerationCore("code", element.getCodeElement(), new CompartmentDefinition.CompartmentTypeEnumFactory(), false);
26825        composeEnumerationExtras("code", element.getCodeElement(), new CompartmentDefinition.CompartmentTypeEnumFactory(), false);
26826      }
26827      if (element.hasSearchElement()) {
26828        composeBooleanCore("search", element.getSearchElement(), false);
26829        composeBooleanExtras("search", element.getSearchElement(), false);
26830      }
26831      if (element.hasResource()) {
26832        openArray("resource");
26833        for (CompartmentDefinition.CompartmentDefinitionResourceComponent e : element.getResource()) 
26834          composeCompartmentDefinitionCompartmentDefinitionResourceComponent(null, e);
26835        closeArray();
26836      };
26837  }
26838
26839  protected void composeCompartmentDefinitionCompartmentDefinitionResourceComponent(String name, CompartmentDefinition.CompartmentDefinitionResourceComponent element) throws IOException {
26840    if (element != null) {
26841      open(name);
26842      composeCompartmentDefinitionCompartmentDefinitionResourceComponentInner(element);
26843      close();
26844    }
26845  }
26846
26847  protected void composeCompartmentDefinitionCompartmentDefinitionResourceComponentInner(CompartmentDefinition.CompartmentDefinitionResourceComponent element) throws IOException {
26848      composeBackbone(element);
26849      if (element.hasCodeElement()) {
26850        composeCodeCore("code", element.getCodeElement(), false);
26851        composeCodeExtras("code", element.getCodeElement(), false);
26852      }
26853      if (element.hasParam()) {
26854        openArray("param");
26855        for (StringType e : element.getParam()) 
26856          composeStringCore(null, e, true);
26857        closeArray();
26858        if (anyHasExtras(element.getParam())) {
26859          openArray("_param");
26860          for (StringType e : element.getParam()) 
26861            composeStringExtras(null, e, true);
26862          closeArray();
26863        }
26864      };
26865      if (element.hasDocumentationElement()) {
26866        composeStringCore("documentation", element.getDocumentationElement(), false);
26867        composeStringExtras("documentation", element.getDocumentationElement(), false);
26868      }
26869  }
26870
26871  protected void composeComposition(String name, Composition element) throws IOException {
26872    if (element != null) {
26873      prop("resourceType", name);
26874      composeCompositionInner(element);
26875    }
26876  }
26877
26878  protected void composeCompositionInner(Composition element) throws IOException {
26879      composeDomainResourceElements(element);
26880      if (element.hasIdentifier()) {
26881        composeIdentifier("identifier", element.getIdentifier());
26882      }
26883      if (element.hasStatusElement()) {
26884        composeEnumerationCore("status", element.getStatusElement(), new Composition.CompositionStatusEnumFactory(), false);
26885        composeEnumerationExtras("status", element.getStatusElement(), new Composition.CompositionStatusEnumFactory(), false);
26886      }
26887      if (element.hasType()) {
26888        composeCodeableConcept("type", element.getType());
26889      }
26890      if (element.hasClass_()) {
26891        composeCodeableConcept("class", element.getClass_());
26892      }
26893      if (element.hasSubject()) {
26894        composeReference("subject", element.getSubject());
26895      }
26896      if (element.hasEncounter()) {
26897        composeReference("encounter", element.getEncounter());
26898      }
26899      if (element.hasDateElement()) {
26900        composeDateTimeCore("date", element.getDateElement(), false);
26901        composeDateTimeExtras("date", element.getDateElement(), false);
26902      }
26903      if (element.hasAuthor()) {
26904        openArray("author");
26905        for (Reference e : element.getAuthor()) 
26906          composeReference(null, e);
26907        closeArray();
26908      };
26909      if (element.hasTitleElement()) {
26910        composeStringCore("title", element.getTitleElement(), false);
26911        composeStringExtras("title", element.getTitleElement(), false);
26912      }
26913      if (element.hasConfidentialityElement()) {
26914        composeEnumerationCore("confidentiality", element.getConfidentialityElement(), new Composition.DocumentConfidentialityEnumFactory(), false);
26915        composeEnumerationExtras("confidentiality", element.getConfidentialityElement(), new Composition.DocumentConfidentialityEnumFactory(), false);
26916      }
26917      if (element.hasAttester()) {
26918        openArray("attester");
26919        for (Composition.CompositionAttesterComponent e : element.getAttester()) 
26920          composeCompositionCompositionAttesterComponent(null, e);
26921        closeArray();
26922      };
26923      if (element.hasCustodian()) {
26924        composeReference("custodian", element.getCustodian());
26925      }
26926      if (element.hasRelatesTo()) {
26927        openArray("relatesTo");
26928        for (Composition.CompositionRelatesToComponent e : element.getRelatesTo()) 
26929          composeCompositionCompositionRelatesToComponent(null, e);
26930        closeArray();
26931      };
26932      if (element.hasEvent()) {
26933        openArray("event");
26934        for (Composition.CompositionEventComponent e : element.getEvent()) 
26935          composeCompositionCompositionEventComponent(null, e);
26936        closeArray();
26937      };
26938      if (element.hasSection()) {
26939        openArray("section");
26940        for (Composition.SectionComponent e : element.getSection()) 
26941          composeCompositionSectionComponent(null, e);
26942        closeArray();
26943      };
26944  }
26945
26946  protected void composeCompositionCompositionAttesterComponent(String name, Composition.CompositionAttesterComponent element) throws IOException {
26947    if (element != null) {
26948      open(name);
26949      composeCompositionCompositionAttesterComponentInner(element);
26950      close();
26951    }
26952  }
26953
26954  protected void composeCompositionCompositionAttesterComponentInner(Composition.CompositionAttesterComponent element) throws IOException {
26955      composeBackbone(element);
26956      if (element.hasMode()) {
26957        openArray("mode");
26958        for (Enumeration<Composition.CompositionAttestationMode> e : element.getMode()) 
26959          composeEnumerationCore(null, e, new Composition.CompositionAttestationModeEnumFactory(), true);
26960        closeArray();
26961        if (anyHasExtras(element.getMode())) {
26962          openArray("_mode");
26963          for (Enumeration<Composition.CompositionAttestationMode> e : element.getMode()) 
26964            composeEnumerationExtras(null, e, new Composition.CompositionAttestationModeEnumFactory(), true);
26965          closeArray();
26966        }
26967      };
26968      if (element.hasTimeElement()) {
26969        composeDateTimeCore("time", element.getTimeElement(), false);
26970        composeDateTimeExtras("time", element.getTimeElement(), false);
26971      }
26972      if (element.hasParty()) {
26973        composeReference("party", element.getParty());
26974      }
26975  }
26976
26977  protected void composeCompositionCompositionRelatesToComponent(String name, Composition.CompositionRelatesToComponent element) throws IOException {
26978    if (element != null) {
26979      open(name);
26980      composeCompositionCompositionRelatesToComponentInner(element);
26981      close();
26982    }
26983  }
26984
26985  protected void composeCompositionCompositionRelatesToComponentInner(Composition.CompositionRelatesToComponent element) throws IOException {
26986      composeBackbone(element);
26987      if (element.hasCodeElement()) {
26988        composeEnumerationCore("code", element.getCodeElement(), new Composition.DocumentRelationshipTypeEnumFactory(), false);
26989        composeEnumerationExtras("code", element.getCodeElement(), new Composition.DocumentRelationshipTypeEnumFactory(), false);
26990      }
26991      if (element.hasTarget()) {
26992        composeType("target", element.getTarget());
26993      }
26994  }
26995
26996  protected void composeCompositionCompositionEventComponent(String name, Composition.CompositionEventComponent element) throws IOException {
26997    if (element != null) {
26998      open(name);
26999      composeCompositionCompositionEventComponentInner(element);
27000      close();
27001    }
27002  }
27003
27004  protected void composeCompositionCompositionEventComponentInner(Composition.CompositionEventComponent element) throws IOException {
27005      composeBackbone(element);
27006      if (element.hasCode()) {
27007        openArray("code");
27008        for (CodeableConcept e : element.getCode()) 
27009          composeCodeableConcept(null, e);
27010        closeArray();
27011      };
27012      if (element.hasPeriod()) {
27013        composePeriod("period", element.getPeriod());
27014      }
27015      if (element.hasDetail()) {
27016        openArray("detail");
27017        for (Reference e : element.getDetail()) 
27018          composeReference(null, e);
27019        closeArray();
27020      };
27021  }
27022
27023  protected void composeCompositionSectionComponent(String name, Composition.SectionComponent element) throws IOException {
27024    if (element != null) {
27025      open(name);
27026      composeCompositionSectionComponentInner(element);
27027      close();
27028    }
27029  }
27030
27031  protected void composeCompositionSectionComponentInner(Composition.SectionComponent element) throws IOException {
27032      composeBackbone(element);
27033      if (element.hasTitleElement()) {
27034        composeStringCore("title", element.getTitleElement(), false);
27035        composeStringExtras("title", element.getTitleElement(), false);
27036      }
27037      if (element.hasCode()) {
27038        composeCodeableConcept("code", element.getCode());
27039      }
27040      if (element.hasText()) {
27041        composeNarrative("text", element.getText());
27042      }
27043      if (element.hasModeElement()) {
27044        composeEnumerationCore("mode", element.getModeElement(), new Composition.SectionModeEnumFactory(), false);
27045        composeEnumerationExtras("mode", element.getModeElement(), new Composition.SectionModeEnumFactory(), false);
27046      }
27047      if (element.hasOrderedBy()) {
27048        composeCodeableConcept("orderedBy", element.getOrderedBy());
27049      }
27050      if (element.hasEntry()) {
27051        openArray("entry");
27052        for (Reference e : element.getEntry()) 
27053          composeReference(null, e);
27054        closeArray();
27055      };
27056      if (element.hasEmptyReason()) {
27057        composeCodeableConcept("emptyReason", element.getEmptyReason());
27058      }
27059      if (element.hasSection()) {
27060        openArray("section");
27061        for (Composition.SectionComponent e : element.getSection()) 
27062          composeCompositionSectionComponent(null, e);
27063        closeArray();
27064      };
27065  }
27066
27067  protected void composeConceptMap(String name, ConceptMap element) throws IOException {
27068    if (element != null) {
27069      prop("resourceType", name);
27070      composeConceptMapInner(element);
27071    }
27072  }
27073
27074  protected void composeConceptMapInner(ConceptMap element) throws IOException {
27075      composeDomainResourceElements(element);
27076      if (element.hasUrlElement()) {
27077        composeUriCore("url", element.getUrlElement(), false);
27078        composeUriExtras("url", element.getUrlElement(), false);
27079      }
27080      if (element.hasIdentifier()) {
27081        composeIdentifier("identifier", element.getIdentifier());
27082      }
27083      if (element.hasVersionElement()) {
27084        composeStringCore("version", element.getVersionElement(), false);
27085        composeStringExtras("version", element.getVersionElement(), false);
27086      }
27087      if (element.hasNameElement()) {
27088        composeStringCore("name", element.getNameElement(), false);
27089        composeStringExtras("name", element.getNameElement(), false);
27090      }
27091      if (element.hasTitleElement()) {
27092        composeStringCore("title", element.getTitleElement(), false);
27093        composeStringExtras("title", element.getTitleElement(), false);
27094      }
27095      if (element.hasStatusElement()) {
27096        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
27097        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
27098      }
27099      if (element.hasExperimentalElement()) {
27100        composeBooleanCore("experimental", element.getExperimentalElement(), false);
27101        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
27102      }
27103      if (element.hasDateElement()) {
27104        composeDateTimeCore("date", element.getDateElement(), false);
27105        composeDateTimeExtras("date", element.getDateElement(), false);
27106      }
27107      if (element.hasPublisherElement()) {
27108        composeStringCore("publisher", element.getPublisherElement(), false);
27109        composeStringExtras("publisher", element.getPublisherElement(), false);
27110      }
27111      if (element.hasContact()) {
27112        openArray("contact");
27113        for (ContactDetail e : element.getContact()) 
27114          composeContactDetail(null, e);
27115        closeArray();
27116      };
27117      if (element.hasDescriptionElement()) {
27118        composeMarkdownCore("description", element.getDescriptionElement(), false);
27119        composeMarkdownExtras("description", element.getDescriptionElement(), false);
27120      }
27121      if (element.hasUseContext()) {
27122        openArray("useContext");
27123        for (UsageContext e : element.getUseContext()) 
27124          composeUsageContext(null, e);
27125        closeArray();
27126      };
27127      if (element.hasJurisdiction()) {
27128        openArray("jurisdiction");
27129        for (CodeableConcept e : element.getJurisdiction()) 
27130          composeCodeableConcept(null, e);
27131        closeArray();
27132      };
27133      if (element.hasPurposeElement()) {
27134        composeMarkdownCore("purpose", element.getPurposeElement(), false);
27135        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
27136      }
27137      if (element.hasCopyrightElement()) {
27138        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
27139        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
27140      }
27141      if (element.hasSource()) {
27142        composeType("source", element.getSource());
27143      }
27144      if (element.hasTarget()) {
27145        composeType("target", element.getTarget());
27146      }
27147      if (element.hasGroup()) {
27148        openArray("group");
27149        for (ConceptMap.ConceptMapGroupComponent e : element.getGroup()) 
27150          composeConceptMapConceptMapGroupComponent(null, e);
27151        closeArray();
27152      };
27153  }
27154
27155  protected void composeConceptMapConceptMapGroupComponent(String name, ConceptMap.ConceptMapGroupComponent element) throws IOException {
27156    if (element != null) {
27157      open(name);
27158      composeConceptMapConceptMapGroupComponentInner(element);
27159      close();
27160    }
27161  }
27162
27163  protected void composeConceptMapConceptMapGroupComponentInner(ConceptMap.ConceptMapGroupComponent element) throws IOException {
27164      composeBackbone(element);
27165      if (element.hasSourceElement()) {
27166        composeUriCore("source", element.getSourceElement(), false);
27167        composeUriExtras("source", element.getSourceElement(), false);
27168      }
27169      if (element.hasSourceVersionElement()) {
27170        composeStringCore("sourceVersion", element.getSourceVersionElement(), false);
27171        composeStringExtras("sourceVersion", element.getSourceVersionElement(), false);
27172      }
27173      if (element.hasTargetElement()) {
27174        composeUriCore("target", element.getTargetElement(), false);
27175        composeUriExtras("target", element.getTargetElement(), false);
27176      }
27177      if (element.hasTargetVersionElement()) {
27178        composeStringCore("targetVersion", element.getTargetVersionElement(), false);
27179        composeStringExtras("targetVersion", element.getTargetVersionElement(), false);
27180      }
27181      if (element.hasElement()) {
27182        openArray("element");
27183        for (ConceptMap.SourceElementComponent e : element.getElement()) 
27184          composeConceptMapSourceElementComponent(null, e);
27185        closeArray();
27186      };
27187      if (element.hasUnmapped()) {
27188        composeConceptMapConceptMapGroupUnmappedComponent("unmapped", element.getUnmapped());
27189      }
27190  }
27191
27192  protected void composeConceptMapSourceElementComponent(String name, ConceptMap.SourceElementComponent element) throws IOException {
27193    if (element != null) {
27194      open(name);
27195      composeConceptMapSourceElementComponentInner(element);
27196      close();
27197    }
27198  }
27199
27200  protected void composeConceptMapSourceElementComponentInner(ConceptMap.SourceElementComponent element) throws IOException {
27201      composeBackbone(element);
27202      if (element.hasCodeElement()) {
27203        composeCodeCore("code", element.getCodeElement(), false);
27204        composeCodeExtras("code", element.getCodeElement(), false);
27205      }
27206      if (element.hasDisplayElement()) {
27207        composeStringCore("display", element.getDisplayElement(), false);
27208        composeStringExtras("display", element.getDisplayElement(), false);
27209      }
27210      if (element.hasTarget()) {
27211        openArray("target");
27212        for (ConceptMap.TargetElementComponent e : element.getTarget()) 
27213          composeConceptMapTargetElementComponent(null, e);
27214        closeArray();
27215      };
27216  }
27217
27218  protected void composeConceptMapTargetElementComponent(String name, ConceptMap.TargetElementComponent element) throws IOException {
27219    if (element != null) {
27220      open(name);
27221      composeConceptMapTargetElementComponentInner(element);
27222      close();
27223    }
27224  }
27225
27226  protected void composeConceptMapTargetElementComponentInner(ConceptMap.TargetElementComponent element) throws IOException {
27227      composeBackbone(element);
27228      if (element.hasCodeElement()) {
27229        composeCodeCore("code", element.getCodeElement(), false);
27230        composeCodeExtras("code", element.getCodeElement(), false);
27231      }
27232      if (element.hasDisplayElement()) {
27233        composeStringCore("display", element.getDisplayElement(), false);
27234        composeStringExtras("display", element.getDisplayElement(), false);
27235      }
27236      if (element.hasEquivalenceElement()) {
27237        composeEnumerationCore("equivalence", element.getEquivalenceElement(), new Enumerations.ConceptMapEquivalenceEnumFactory(), false);
27238        composeEnumerationExtras("equivalence", element.getEquivalenceElement(), new Enumerations.ConceptMapEquivalenceEnumFactory(), false);
27239      }
27240      if (element.hasCommentElement()) {
27241        composeStringCore("comment", element.getCommentElement(), false);
27242        composeStringExtras("comment", element.getCommentElement(), false);
27243      }
27244      if (element.hasDependsOn()) {
27245        openArray("dependsOn");
27246        for (ConceptMap.OtherElementComponent e : element.getDependsOn()) 
27247          composeConceptMapOtherElementComponent(null, e);
27248        closeArray();
27249      };
27250      if (element.hasProduct()) {
27251        openArray("product");
27252        for (ConceptMap.OtherElementComponent e : element.getProduct()) 
27253          composeConceptMapOtherElementComponent(null, e);
27254        closeArray();
27255      };
27256  }
27257
27258  protected void composeConceptMapOtherElementComponent(String name, ConceptMap.OtherElementComponent element) throws IOException {
27259    if (element != null) {
27260      open(name);
27261      composeConceptMapOtherElementComponentInner(element);
27262      close();
27263    }
27264  }
27265
27266  protected void composeConceptMapOtherElementComponentInner(ConceptMap.OtherElementComponent element) throws IOException {
27267      composeBackbone(element);
27268      if (element.hasPropertyElement()) {
27269        composeUriCore("property", element.getPropertyElement(), false);
27270        composeUriExtras("property", element.getPropertyElement(), false);
27271      }
27272      if (element.hasSystemElement()) {
27273        composeUriCore("system", element.getSystemElement(), false);
27274        composeUriExtras("system", element.getSystemElement(), false);
27275      }
27276      if (element.hasCodeElement()) {
27277        composeStringCore("code", element.getCodeElement(), false);
27278        composeStringExtras("code", element.getCodeElement(), false);
27279      }
27280      if (element.hasDisplayElement()) {
27281        composeStringCore("display", element.getDisplayElement(), false);
27282        composeStringExtras("display", element.getDisplayElement(), false);
27283      }
27284  }
27285
27286  protected void composeConceptMapConceptMapGroupUnmappedComponent(String name, ConceptMap.ConceptMapGroupUnmappedComponent element) throws IOException {
27287    if (element != null) {
27288      open(name);
27289      composeConceptMapConceptMapGroupUnmappedComponentInner(element);
27290      close();
27291    }
27292  }
27293
27294  protected void composeConceptMapConceptMapGroupUnmappedComponentInner(ConceptMap.ConceptMapGroupUnmappedComponent element) throws IOException {
27295      composeBackbone(element);
27296      if (element.hasModeElement()) {
27297        composeEnumerationCore("mode", element.getModeElement(), new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory(), false);
27298        composeEnumerationExtras("mode", element.getModeElement(), new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory(), false);
27299      }
27300      if (element.hasCodeElement()) {
27301        composeCodeCore("code", element.getCodeElement(), false);
27302        composeCodeExtras("code", element.getCodeElement(), false);
27303      }
27304      if (element.hasDisplayElement()) {
27305        composeStringCore("display", element.getDisplayElement(), false);
27306        composeStringExtras("display", element.getDisplayElement(), false);
27307      }
27308      if (element.hasUrlElement()) {
27309        composeUriCore("url", element.getUrlElement(), false);
27310        composeUriExtras("url", element.getUrlElement(), false);
27311      }
27312  }
27313
27314  protected void composeCondition(String name, Condition element) throws IOException {
27315    if (element != null) {
27316      prop("resourceType", name);
27317      composeConditionInner(element);
27318    }
27319  }
27320
27321  protected void composeConditionInner(Condition element) throws IOException {
27322      composeDomainResourceElements(element);
27323      if (element.hasIdentifier()) {
27324        openArray("identifier");
27325        for (Identifier e : element.getIdentifier()) 
27326          composeIdentifier(null, e);
27327        closeArray();
27328      };
27329      if (element.hasClinicalStatusElement()) {
27330        composeEnumerationCore("clinicalStatus", element.getClinicalStatusElement(), new Condition.ConditionClinicalStatusEnumFactory(), false);
27331        composeEnumerationExtras("clinicalStatus", element.getClinicalStatusElement(), new Condition.ConditionClinicalStatusEnumFactory(), false);
27332      }
27333      if (element.hasVerificationStatusElement()) {
27334        composeEnumerationCore("verificationStatus", element.getVerificationStatusElement(), new Condition.ConditionVerificationStatusEnumFactory(), false);
27335        composeEnumerationExtras("verificationStatus", element.getVerificationStatusElement(), new Condition.ConditionVerificationStatusEnumFactory(), false);
27336      }
27337      if (element.hasCategory()) {
27338        openArray("category");
27339        for (CodeableConcept e : element.getCategory()) 
27340          composeCodeableConcept(null, e);
27341        closeArray();
27342      };
27343      if (element.hasSeverity()) {
27344        composeCodeableConcept("severity", element.getSeverity());
27345      }
27346      if (element.hasCode()) {
27347        composeCodeableConcept("code", element.getCode());
27348      }
27349      if (element.hasBodySite()) {
27350        openArray("bodySite");
27351        for (CodeableConcept e : element.getBodySite()) 
27352          composeCodeableConcept(null, e);
27353        closeArray();
27354      };
27355      if (element.hasSubject()) {
27356        composeReference("subject", element.getSubject());
27357      }
27358      if (element.hasContext()) {
27359        composeReference("context", element.getContext());
27360      }
27361      if (element.hasOnset()) {
27362        composeType("onset", element.getOnset());
27363      }
27364      if (element.hasAbatement()) {
27365        composeType("abatement", element.getAbatement());
27366      }
27367      if (element.hasAssertedDateElement()) {
27368        composeDateTimeCore("assertedDate", element.getAssertedDateElement(), false);
27369        composeDateTimeExtras("assertedDate", element.getAssertedDateElement(), false);
27370      }
27371      if (element.hasAsserter()) {
27372        composeReference("asserter", element.getAsserter());
27373      }
27374      if (element.hasStage()) {
27375        composeConditionConditionStageComponent("stage", element.getStage());
27376      }
27377      if (element.hasEvidence()) {
27378        openArray("evidence");
27379        for (Condition.ConditionEvidenceComponent e : element.getEvidence()) 
27380          composeConditionConditionEvidenceComponent(null, e);
27381        closeArray();
27382      };
27383      if (element.hasNote()) {
27384        openArray("note");
27385        for (Annotation e : element.getNote()) 
27386          composeAnnotation(null, e);
27387        closeArray();
27388      };
27389  }
27390
27391  protected void composeConditionConditionStageComponent(String name, Condition.ConditionStageComponent element) throws IOException {
27392    if (element != null) {
27393      open(name);
27394      composeConditionConditionStageComponentInner(element);
27395      close();
27396    }
27397  }
27398
27399  protected void composeConditionConditionStageComponentInner(Condition.ConditionStageComponent element) throws IOException {
27400      composeBackbone(element);
27401      if (element.hasSummary()) {
27402        composeCodeableConcept("summary", element.getSummary());
27403      }
27404      if (element.hasAssessment()) {
27405        openArray("assessment");
27406        for (Reference e : element.getAssessment()) 
27407          composeReference(null, e);
27408        closeArray();
27409      };
27410  }
27411
27412  protected void composeConditionConditionEvidenceComponent(String name, Condition.ConditionEvidenceComponent element) throws IOException {
27413    if (element != null) {
27414      open(name);
27415      composeConditionConditionEvidenceComponentInner(element);
27416      close();
27417    }
27418  }
27419
27420  protected void composeConditionConditionEvidenceComponentInner(Condition.ConditionEvidenceComponent element) throws IOException {
27421      composeBackbone(element);
27422      if (element.hasCode()) {
27423        openArray("code");
27424        for (CodeableConcept e : element.getCode()) 
27425          composeCodeableConcept(null, e);
27426        closeArray();
27427      };
27428      if (element.hasDetail()) {
27429        openArray("detail");
27430        for (Reference e : element.getDetail()) 
27431          composeReference(null, e);
27432        closeArray();
27433      };
27434  }
27435
27436  protected void composeConsent(String name, Consent element) throws IOException {
27437    if (element != null) {
27438      prop("resourceType", name);
27439      composeConsentInner(element);
27440    }
27441  }
27442
27443  protected void composeConsentInner(Consent element) throws IOException {
27444      composeDomainResourceElements(element);
27445      if (element.hasIdentifier()) {
27446        composeIdentifier("identifier", element.getIdentifier());
27447      }
27448      if (element.hasStatusElement()) {
27449        composeEnumerationCore("status", element.getStatusElement(), new Consent.ConsentStateEnumFactory(), false);
27450        composeEnumerationExtras("status", element.getStatusElement(), new Consent.ConsentStateEnumFactory(), false);
27451      }
27452      if (element.hasCategory()) {
27453        openArray("category");
27454        for (CodeableConcept e : element.getCategory()) 
27455          composeCodeableConcept(null, e);
27456        closeArray();
27457      };
27458      if (element.hasPatient()) {
27459        composeReference("patient", element.getPatient());
27460      }
27461      if (element.hasPeriod()) {
27462        composePeriod("period", element.getPeriod());
27463      }
27464      if (element.hasDateTimeElement()) {
27465        composeDateTimeCore("dateTime", element.getDateTimeElement(), false);
27466        composeDateTimeExtras("dateTime", element.getDateTimeElement(), false);
27467      }
27468      if (element.hasConsentingParty()) {
27469        openArray("consentingParty");
27470        for (Reference e : element.getConsentingParty()) 
27471          composeReference(null, e);
27472        closeArray();
27473      };
27474      if (element.hasActor()) {
27475        openArray("actor");
27476        for (Consent.ConsentActorComponent e : element.getActor()) 
27477          composeConsentConsentActorComponent(null, e);
27478        closeArray();
27479      };
27480      if (element.hasAction()) {
27481        openArray("action");
27482        for (CodeableConcept e : element.getAction()) 
27483          composeCodeableConcept(null, e);
27484        closeArray();
27485      };
27486      if (element.hasOrganization()) {
27487        openArray("organization");
27488        for (Reference e : element.getOrganization()) 
27489          composeReference(null, e);
27490        closeArray();
27491      };
27492      if (element.hasSource()) {
27493        composeType("source", element.getSource());
27494      }
27495      if (element.hasPolicy()) {
27496        openArray("policy");
27497        for (Consent.ConsentPolicyComponent e : element.getPolicy()) 
27498          composeConsentConsentPolicyComponent(null, e);
27499        closeArray();
27500      };
27501      if (element.hasPolicyRuleElement()) {
27502        composeUriCore("policyRule", element.getPolicyRuleElement(), false);
27503        composeUriExtras("policyRule", element.getPolicyRuleElement(), false);
27504      }
27505      if (element.hasSecurityLabel()) {
27506        openArray("securityLabel");
27507        for (Coding e : element.getSecurityLabel()) 
27508          composeCoding(null, e);
27509        closeArray();
27510      };
27511      if (element.hasPurpose()) {
27512        openArray("purpose");
27513        for (Coding e : element.getPurpose()) 
27514          composeCoding(null, e);
27515        closeArray();
27516      };
27517      if (element.hasDataPeriod()) {
27518        composePeriod("dataPeriod", element.getDataPeriod());
27519      }
27520      if (element.hasData()) {
27521        openArray("data");
27522        for (Consent.ConsentDataComponent e : element.getData()) 
27523          composeConsentConsentDataComponent(null, e);
27524        closeArray();
27525      };
27526      if (element.hasExcept()) {
27527        openArray("except");
27528        for (Consent.ExceptComponent e : element.getExcept()) 
27529          composeConsentExceptComponent(null, e);
27530        closeArray();
27531      };
27532  }
27533
27534  protected void composeConsentConsentActorComponent(String name, Consent.ConsentActorComponent element) throws IOException {
27535    if (element != null) {
27536      open(name);
27537      composeConsentConsentActorComponentInner(element);
27538      close();
27539    }
27540  }
27541
27542  protected void composeConsentConsentActorComponentInner(Consent.ConsentActorComponent element) throws IOException {
27543      composeBackbone(element);
27544      if (element.hasRole()) {
27545        composeCodeableConcept("role", element.getRole());
27546      }
27547      if (element.hasReference()) {
27548        composeReference("reference", element.getReference());
27549      }
27550  }
27551
27552  protected void composeConsentConsentPolicyComponent(String name, Consent.ConsentPolicyComponent element) throws IOException {
27553    if (element != null) {
27554      open(name);
27555      composeConsentConsentPolicyComponentInner(element);
27556      close();
27557    }
27558  }
27559
27560  protected void composeConsentConsentPolicyComponentInner(Consent.ConsentPolicyComponent element) throws IOException {
27561      composeBackbone(element);
27562      if (element.hasAuthorityElement()) {
27563        composeUriCore("authority", element.getAuthorityElement(), false);
27564        composeUriExtras("authority", element.getAuthorityElement(), false);
27565      }
27566      if (element.hasUriElement()) {
27567        composeUriCore("uri", element.getUriElement(), false);
27568        composeUriExtras("uri", element.getUriElement(), false);
27569      }
27570  }
27571
27572  protected void composeConsentConsentDataComponent(String name, Consent.ConsentDataComponent element) throws IOException {
27573    if (element != null) {
27574      open(name);
27575      composeConsentConsentDataComponentInner(element);
27576      close();
27577    }
27578  }
27579
27580  protected void composeConsentConsentDataComponentInner(Consent.ConsentDataComponent element) throws IOException {
27581      composeBackbone(element);
27582      if (element.hasMeaningElement()) {
27583        composeEnumerationCore("meaning", element.getMeaningElement(), new Consent.ConsentDataMeaningEnumFactory(), false);
27584        composeEnumerationExtras("meaning", element.getMeaningElement(), new Consent.ConsentDataMeaningEnumFactory(), false);
27585      }
27586      if (element.hasReference()) {
27587        composeReference("reference", element.getReference());
27588      }
27589  }
27590
27591  protected void composeConsentExceptComponent(String name, Consent.ExceptComponent element) throws IOException {
27592    if (element != null) {
27593      open(name);
27594      composeConsentExceptComponentInner(element);
27595      close();
27596    }
27597  }
27598
27599  protected void composeConsentExceptComponentInner(Consent.ExceptComponent element) throws IOException {
27600      composeBackbone(element);
27601      if (element.hasTypeElement()) {
27602        composeEnumerationCore("type", element.getTypeElement(), new Consent.ConsentExceptTypeEnumFactory(), false);
27603        composeEnumerationExtras("type", element.getTypeElement(), new Consent.ConsentExceptTypeEnumFactory(), false);
27604      }
27605      if (element.hasPeriod()) {
27606        composePeriod("period", element.getPeriod());
27607      }
27608      if (element.hasActor()) {
27609        openArray("actor");
27610        for (Consent.ExceptActorComponent e : element.getActor()) 
27611          composeConsentExceptActorComponent(null, e);
27612        closeArray();
27613      };
27614      if (element.hasAction()) {
27615        openArray("action");
27616        for (CodeableConcept e : element.getAction()) 
27617          composeCodeableConcept(null, e);
27618        closeArray();
27619      };
27620      if (element.hasSecurityLabel()) {
27621        openArray("securityLabel");
27622        for (Coding e : element.getSecurityLabel()) 
27623          composeCoding(null, e);
27624        closeArray();
27625      };
27626      if (element.hasPurpose()) {
27627        openArray("purpose");
27628        for (Coding e : element.getPurpose()) 
27629          composeCoding(null, e);
27630        closeArray();
27631      };
27632      if (element.hasClass_()) {
27633        openArray("class");
27634        for (Coding e : element.getClass_()) 
27635          composeCoding(null, e);
27636        closeArray();
27637      };
27638      if (element.hasCode()) {
27639        openArray("code");
27640        for (Coding e : element.getCode()) 
27641          composeCoding(null, e);
27642        closeArray();
27643      };
27644      if (element.hasDataPeriod()) {
27645        composePeriod("dataPeriod", element.getDataPeriod());
27646      }
27647      if (element.hasData()) {
27648        openArray("data");
27649        for (Consent.ExceptDataComponent e : element.getData()) 
27650          composeConsentExceptDataComponent(null, e);
27651        closeArray();
27652      };
27653  }
27654
27655  protected void composeConsentExceptActorComponent(String name, Consent.ExceptActorComponent element) throws IOException {
27656    if (element != null) {
27657      open(name);
27658      composeConsentExceptActorComponentInner(element);
27659      close();
27660    }
27661  }
27662
27663  protected void composeConsentExceptActorComponentInner(Consent.ExceptActorComponent element) throws IOException {
27664      composeBackbone(element);
27665      if (element.hasRole()) {
27666        composeCodeableConcept("role", element.getRole());
27667      }
27668      if (element.hasReference()) {
27669        composeReference("reference", element.getReference());
27670      }
27671  }
27672
27673  protected void composeConsentExceptDataComponent(String name, Consent.ExceptDataComponent element) throws IOException {
27674    if (element != null) {
27675      open(name);
27676      composeConsentExceptDataComponentInner(element);
27677      close();
27678    }
27679  }
27680
27681  protected void composeConsentExceptDataComponentInner(Consent.ExceptDataComponent element) throws IOException {
27682      composeBackbone(element);
27683      if (element.hasMeaningElement()) {
27684        composeEnumerationCore("meaning", element.getMeaningElement(), new Consent.ConsentDataMeaningEnumFactory(), false);
27685        composeEnumerationExtras("meaning", element.getMeaningElement(), new Consent.ConsentDataMeaningEnumFactory(), false);
27686      }
27687      if (element.hasReference()) {
27688        composeReference("reference", element.getReference());
27689      }
27690  }
27691
27692  protected void composeContract(String name, Contract element) throws IOException {
27693    if (element != null) {
27694      prop("resourceType", name);
27695      composeContractInner(element);
27696    }
27697  }
27698
27699  protected void composeContractInner(Contract element) throws IOException {
27700      composeDomainResourceElements(element);
27701      if (element.hasIdentifier()) {
27702        composeIdentifier("identifier", element.getIdentifier());
27703      }
27704      if (element.hasStatusElement()) {
27705        composeEnumerationCore("status", element.getStatusElement(), new Contract.ContractStatusEnumFactory(), false);
27706        composeEnumerationExtras("status", element.getStatusElement(), new Contract.ContractStatusEnumFactory(), false);
27707      }
27708      if (element.hasIssuedElement()) {
27709        composeDateTimeCore("issued", element.getIssuedElement(), false);
27710        composeDateTimeExtras("issued", element.getIssuedElement(), false);
27711      }
27712      if (element.hasApplies()) {
27713        composePeriod("applies", element.getApplies());
27714      }
27715      if (element.hasSubject()) {
27716        openArray("subject");
27717        for (Reference e : element.getSubject()) 
27718          composeReference(null, e);
27719        closeArray();
27720      };
27721      if (element.hasTopic()) {
27722        openArray("topic");
27723        for (Reference e : element.getTopic()) 
27724          composeReference(null, e);
27725        closeArray();
27726      };
27727      if (element.hasAuthority()) {
27728        openArray("authority");
27729        for (Reference e : element.getAuthority()) 
27730          composeReference(null, e);
27731        closeArray();
27732      };
27733      if (element.hasDomain()) {
27734        openArray("domain");
27735        for (Reference e : element.getDomain()) 
27736          composeReference(null, e);
27737        closeArray();
27738      };
27739      if (element.hasType()) {
27740        composeCodeableConcept("type", element.getType());
27741      }
27742      if (element.hasSubType()) {
27743        openArray("subType");
27744        for (CodeableConcept e : element.getSubType()) 
27745          composeCodeableConcept(null, e);
27746        closeArray();
27747      };
27748      if (element.hasAction()) {
27749        openArray("action");
27750        for (CodeableConcept e : element.getAction()) 
27751          composeCodeableConcept(null, e);
27752        closeArray();
27753      };
27754      if (element.hasActionReason()) {
27755        openArray("actionReason");
27756        for (CodeableConcept e : element.getActionReason()) 
27757          composeCodeableConcept(null, e);
27758        closeArray();
27759      };
27760      if (element.hasDecisionType()) {
27761        composeCodeableConcept("decisionType", element.getDecisionType());
27762      }
27763      if (element.hasContentDerivative()) {
27764        composeCodeableConcept("contentDerivative", element.getContentDerivative());
27765      }
27766      if (element.hasSecurityLabel()) {
27767        openArray("securityLabel");
27768        for (Coding e : element.getSecurityLabel()) 
27769          composeCoding(null, e);
27770        closeArray();
27771      };
27772      if (element.hasAgent()) {
27773        openArray("agent");
27774        for (Contract.AgentComponent e : element.getAgent()) 
27775          composeContractAgentComponent(null, e);
27776        closeArray();
27777      };
27778      if (element.hasSigner()) {
27779        openArray("signer");
27780        for (Contract.SignatoryComponent e : element.getSigner()) 
27781          composeContractSignatoryComponent(null, e);
27782        closeArray();
27783      };
27784      if (element.hasValuedItem()) {
27785        openArray("valuedItem");
27786        for (Contract.ValuedItemComponent e : element.getValuedItem()) 
27787          composeContractValuedItemComponent(null, e);
27788        closeArray();
27789      };
27790      if (element.hasTerm()) {
27791        openArray("term");
27792        for (Contract.TermComponent e : element.getTerm()) 
27793          composeContractTermComponent(null, e);
27794        closeArray();
27795      };
27796      if (element.hasBinding()) {
27797        composeType("binding", element.getBinding());
27798      }
27799      if (element.hasFriendly()) {
27800        openArray("friendly");
27801        for (Contract.FriendlyLanguageComponent e : element.getFriendly()) 
27802          composeContractFriendlyLanguageComponent(null, e);
27803        closeArray();
27804      };
27805      if (element.hasLegal()) {
27806        openArray("legal");
27807        for (Contract.LegalLanguageComponent e : element.getLegal()) 
27808          composeContractLegalLanguageComponent(null, e);
27809        closeArray();
27810      };
27811      if (element.hasRule()) {
27812        openArray("rule");
27813        for (Contract.ComputableLanguageComponent e : element.getRule()) 
27814          composeContractComputableLanguageComponent(null, e);
27815        closeArray();
27816      };
27817  }
27818
27819  protected void composeContractAgentComponent(String name, Contract.AgentComponent element) throws IOException {
27820    if (element != null) {
27821      open(name);
27822      composeContractAgentComponentInner(element);
27823      close();
27824    }
27825  }
27826
27827  protected void composeContractAgentComponentInner(Contract.AgentComponent element) throws IOException {
27828      composeBackbone(element);
27829      if (element.hasActor()) {
27830        composeReference("actor", element.getActor());
27831      }
27832      if (element.hasRole()) {
27833        openArray("role");
27834        for (CodeableConcept e : element.getRole()) 
27835          composeCodeableConcept(null, e);
27836        closeArray();
27837      };
27838  }
27839
27840  protected void composeContractSignatoryComponent(String name, Contract.SignatoryComponent element) throws IOException {
27841    if (element != null) {
27842      open(name);
27843      composeContractSignatoryComponentInner(element);
27844      close();
27845    }
27846  }
27847
27848  protected void composeContractSignatoryComponentInner(Contract.SignatoryComponent element) throws IOException {
27849      composeBackbone(element);
27850      if (element.hasType()) {
27851        composeCoding("type", element.getType());
27852      }
27853      if (element.hasParty()) {
27854        composeReference("party", element.getParty());
27855      }
27856      if (element.hasSignature()) {
27857        openArray("signature");
27858        for (Signature e : element.getSignature()) 
27859          composeSignature(null, e);
27860        closeArray();
27861      };
27862  }
27863
27864  protected void composeContractValuedItemComponent(String name, Contract.ValuedItemComponent element) throws IOException {
27865    if (element != null) {
27866      open(name);
27867      composeContractValuedItemComponentInner(element);
27868      close();
27869    }
27870  }
27871
27872  protected void composeContractValuedItemComponentInner(Contract.ValuedItemComponent element) throws IOException {
27873      composeBackbone(element);
27874      if (element.hasEntity()) {
27875        composeType("entity", element.getEntity());
27876      }
27877      if (element.hasIdentifier()) {
27878        composeIdentifier("identifier", element.getIdentifier());
27879      }
27880      if (element.hasEffectiveTimeElement()) {
27881        composeDateTimeCore("effectiveTime", element.getEffectiveTimeElement(), false);
27882        composeDateTimeExtras("effectiveTime", element.getEffectiveTimeElement(), false);
27883      }
27884      if (element.hasQuantity()) {
27885        composeSimpleQuantity("quantity", element.getQuantity());
27886      }
27887      if (element.hasUnitPrice()) {
27888        composeMoney("unitPrice", element.getUnitPrice());
27889      }
27890      if (element.hasFactorElement()) {
27891        composeDecimalCore("factor", element.getFactorElement(), false);
27892        composeDecimalExtras("factor", element.getFactorElement(), false);
27893      }
27894      if (element.hasPointsElement()) {
27895        composeDecimalCore("points", element.getPointsElement(), false);
27896        composeDecimalExtras("points", element.getPointsElement(), false);
27897      }
27898      if (element.hasNet()) {
27899        composeMoney("net", element.getNet());
27900      }
27901  }
27902
27903  protected void composeContractTermComponent(String name, Contract.TermComponent element) throws IOException {
27904    if (element != null) {
27905      open(name);
27906      composeContractTermComponentInner(element);
27907      close();
27908    }
27909  }
27910
27911  protected void composeContractTermComponentInner(Contract.TermComponent element) throws IOException {
27912      composeBackbone(element);
27913      if (element.hasIdentifier()) {
27914        composeIdentifier("identifier", element.getIdentifier());
27915      }
27916      if (element.hasIssuedElement()) {
27917        composeDateTimeCore("issued", element.getIssuedElement(), false);
27918        composeDateTimeExtras("issued", element.getIssuedElement(), false);
27919      }
27920      if (element.hasApplies()) {
27921        composePeriod("applies", element.getApplies());
27922      }
27923      if (element.hasType()) {
27924        composeCodeableConcept("type", element.getType());
27925      }
27926      if (element.hasSubType()) {
27927        composeCodeableConcept("subType", element.getSubType());
27928      }
27929      if (element.hasTopic()) {
27930        openArray("topic");
27931        for (Reference e : element.getTopic()) 
27932          composeReference(null, e);
27933        closeArray();
27934      };
27935      if (element.hasAction()) {
27936        openArray("action");
27937        for (CodeableConcept e : element.getAction()) 
27938          composeCodeableConcept(null, e);
27939        closeArray();
27940      };
27941      if (element.hasActionReason()) {
27942        openArray("actionReason");
27943        for (CodeableConcept e : element.getActionReason()) 
27944          composeCodeableConcept(null, e);
27945        closeArray();
27946      };
27947      if (element.hasSecurityLabel()) {
27948        openArray("securityLabel");
27949        for (Coding e : element.getSecurityLabel()) 
27950          composeCoding(null, e);
27951        closeArray();
27952      };
27953      if (element.hasAgent()) {
27954        openArray("agent");
27955        for (Contract.TermAgentComponent e : element.getAgent()) 
27956          composeContractTermAgentComponent(null, e);
27957        closeArray();
27958      };
27959      if (element.hasTextElement()) {
27960        composeStringCore("text", element.getTextElement(), false);
27961        composeStringExtras("text", element.getTextElement(), false);
27962      }
27963      if (element.hasValuedItem()) {
27964        openArray("valuedItem");
27965        for (Contract.TermValuedItemComponent e : element.getValuedItem()) 
27966          composeContractTermValuedItemComponent(null, e);
27967        closeArray();
27968      };
27969      if (element.hasGroup()) {
27970        openArray("group");
27971        for (Contract.TermComponent e : element.getGroup()) 
27972          composeContractTermComponent(null, e);
27973        closeArray();
27974      };
27975  }
27976
27977  protected void composeContractTermAgentComponent(String name, Contract.TermAgentComponent element) throws IOException {
27978    if (element != null) {
27979      open(name);
27980      composeContractTermAgentComponentInner(element);
27981      close();
27982    }
27983  }
27984
27985  protected void composeContractTermAgentComponentInner(Contract.TermAgentComponent element) throws IOException {
27986      composeBackbone(element);
27987      if (element.hasActor()) {
27988        composeReference("actor", element.getActor());
27989      }
27990      if (element.hasRole()) {
27991        openArray("role");
27992        for (CodeableConcept e : element.getRole()) 
27993          composeCodeableConcept(null, e);
27994        closeArray();
27995      };
27996  }
27997
27998  protected void composeContractTermValuedItemComponent(String name, Contract.TermValuedItemComponent element) throws IOException {
27999    if (element != null) {
28000      open(name);
28001      composeContractTermValuedItemComponentInner(element);
28002      close();
28003    }
28004  }
28005
28006  protected void composeContractTermValuedItemComponentInner(Contract.TermValuedItemComponent element) throws IOException {
28007      composeBackbone(element);
28008      if (element.hasEntity()) {
28009        composeType("entity", element.getEntity());
28010      }
28011      if (element.hasIdentifier()) {
28012        composeIdentifier("identifier", element.getIdentifier());
28013      }
28014      if (element.hasEffectiveTimeElement()) {
28015        composeDateTimeCore("effectiveTime", element.getEffectiveTimeElement(), false);
28016        composeDateTimeExtras("effectiveTime", element.getEffectiveTimeElement(), false);
28017      }
28018      if (element.hasQuantity()) {
28019        composeSimpleQuantity("quantity", element.getQuantity());
28020      }
28021      if (element.hasUnitPrice()) {
28022        composeMoney("unitPrice", element.getUnitPrice());
28023      }
28024      if (element.hasFactorElement()) {
28025        composeDecimalCore("factor", element.getFactorElement(), false);
28026        composeDecimalExtras("factor", element.getFactorElement(), false);
28027      }
28028      if (element.hasPointsElement()) {
28029        composeDecimalCore("points", element.getPointsElement(), false);
28030        composeDecimalExtras("points", element.getPointsElement(), false);
28031      }
28032      if (element.hasNet()) {
28033        composeMoney("net", element.getNet());
28034      }
28035  }
28036
28037  protected void composeContractFriendlyLanguageComponent(String name, Contract.FriendlyLanguageComponent element) throws IOException {
28038    if (element != null) {
28039      open(name);
28040      composeContractFriendlyLanguageComponentInner(element);
28041      close();
28042    }
28043  }
28044
28045  protected void composeContractFriendlyLanguageComponentInner(Contract.FriendlyLanguageComponent element) throws IOException {
28046      composeBackbone(element);
28047      if (element.hasContent()) {
28048        composeType("content", element.getContent());
28049      }
28050  }
28051
28052  protected void composeContractLegalLanguageComponent(String name, Contract.LegalLanguageComponent element) throws IOException {
28053    if (element != null) {
28054      open(name);
28055      composeContractLegalLanguageComponentInner(element);
28056      close();
28057    }
28058  }
28059
28060  protected void composeContractLegalLanguageComponentInner(Contract.LegalLanguageComponent element) throws IOException {
28061      composeBackbone(element);
28062      if (element.hasContent()) {
28063        composeType("content", element.getContent());
28064      }
28065  }
28066
28067  protected void composeContractComputableLanguageComponent(String name, Contract.ComputableLanguageComponent element) throws IOException {
28068    if (element != null) {
28069      open(name);
28070      composeContractComputableLanguageComponentInner(element);
28071      close();
28072    }
28073  }
28074
28075  protected void composeContractComputableLanguageComponentInner(Contract.ComputableLanguageComponent element) throws IOException {
28076      composeBackbone(element);
28077      if (element.hasContent()) {
28078        composeType("content", element.getContent());
28079      }
28080  }
28081
28082  protected void composeCoverage(String name, Coverage element) throws IOException {
28083    if (element != null) {
28084      prop("resourceType", name);
28085      composeCoverageInner(element);
28086    }
28087  }
28088
28089  protected void composeCoverageInner(Coverage element) throws IOException {
28090      composeDomainResourceElements(element);
28091      if (element.hasIdentifier()) {
28092        openArray("identifier");
28093        for (Identifier e : element.getIdentifier()) 
28094          composeIdentifier(null, e);
28095        closeArray();
28096      };
28097      if (element.hasStatusElement()) {
28098        composeEnumerationCore("status", element.getStatusElement(), new Coverage.CoverageStatusEnumFactory(), false);
28099        composeEnumerationExtras("status", element.getStatusElement(), new Coverage.CoverageStatusEnumFactory(), false);
28100      }
28101      if (element.hasType()) {
28102        composeCodeableConcept("type", element.getType());
28103      }
28104      if (element.hasPolicyHolder()) {
28105        composeReference("policyHolder", element.getPolicyHolder());
28106      }
28107      if (element.hasSubscriber()) {
28108        composeReference("subscriber", element.getSubscriber());
28109      }
28110      if (element.hasSubscriberIdElement()) {
28111        composeStringCore("subscriberId", element.getSubscriberIdElement(), false);
28112        composeStringExtras("subscriberId", element.getSubscriberIdElement(), false);
28113      }
28114      if (element.hasBeneficiary()) {
28115        composeReference("beneficiary", element.getBeneficiary());
28116      }
28117      if (element.hasRelationship()) {
28118        composeCodeableConcept("relationship", element.getRelationship());
28119      }
28120      if (element.hasPeriod()) {
28121        composePeriod("period", element.getPeriod());
28122      }
28123      if (element.hasPayor()) {
28124        openArray("payor");
28125        for (Reference e : element.getPayor()) 
28126          composeReference(null, e);
28127        closeArray();
28128      };
28129      if (element.hasGrouping()) {
28130        composeCoverageGroupComponent("grouping", element.getGrouping());
28131      }
28132      if (element.hasDependentElement()) {
28133        composeStringCore("dependent", element.getDependentElement(), false);
28134        composeStringExtras("dependent", element.getDependentElement(), false);
28135      }
28136      if (element.hasSequenceElement()) {
28137        composeStringCore("sequence", element.getSequenceElement(), false);
28138        composeStringExtras("sequence", element.getSequenceElement(), false);
28139      }
28140      if (element.hasOrderElement()) {
28141        composePositiveIntCore("order", element.getOrderElement(), false);
28142        composePositiveIntExtras("order", element.getOrderElement(), false);
28143      }
28144      if (element.hasNetworkElement()) {
28145        composeStringCore("network", element.getNetworkElement(), false);
28146        composeStringExtras("network", element.getNetworkElement(), false);
28147      }
28148      if (element.hasContract()) {
28149        openArray("contract");
28150        for (Reference e : element.getContract()) 
28151          composeReference(null, e);
28152        closeArray();
28153      };
28154  }
28155
28156  protected void composeCoverageGroupComponent(String name, Coverage.GroupComponent element) throws IOException {
28157    if (element != null) {
28158      open(name);
28159      composeCoverageGroupComponentInner(element);
28160      close();
28161    }
28162  }
28163
28164  protected void composeCoverageGroupComponentInner(Coverage.GroupComponent element) throws IOException {
28165      composeBackbone(element);
28166      if (element.hasGroupElement()) {
28167        composeStringCore("group", element.getGroupElement(), false);
28168        composeStringExtras("group", element.getGroupElement(), false);
28169      }
28170      if (element.hasGroupDisplayElement()) {
28171        composeStringCore("groupDisplay", element.getGroupDisplayElement(), false);
28172        composeStringExtras("groupDisplay", element.getGroupDisplayElement(), false);
28173      }
28174      if (element.hasSubGroupElement()) {
28175        composeStringCore("subGroup", element.getSubGroupElement(), false);
28176        composeStringExtras("subGroup", element.getSubGroupElement(), false);
28177      }
28178      if (element.hasSubGroupDisplayElement()) {
28179        composeStringCore("subGroupDisplay", element.getSubGroupDisplayElement(), false);
28180        composeStringExtras("subGroupDisplay", element.getSubGroupDisplayElement(), false);
28181      }
28182      if (element.hasPlanElement()) {
28183        composeStringCore("plan", element.getPlanElement(), false);
28184        composeStringExtras("plan", element.getPlanElement(), false);
28185      }
28186      if (element.hasPlanDisplayElement()) {
28187        composeStringCore("planDisplay", element.getPlanDisplayElement(), false);
28188        composeStringExtras("planDisplay", element.getPlanDisplayElement(), false);
28189      }
28190      if (element.hasSubPlanElement()) {
28191        composeStringCore("subPlan", element.getSubPlanElement(), false);
28192        composeStringExtras("subPlan", element.getSubPlanElement(), false);
28193      }
28194      if (element.hasSubPlanDisplayElement()) {
28195        composeStringCore("subPlanDisplay", element.getSubPlanDisplayElement(), false);
28196        composeStringExtras("subPlanDisplay", element.getSubPlanDisplayElement(), false);
28197      }
28198      if (element.hasClass_Element()) {
28199        composeStringCore("class", element.getClass_Element(), false);
28200        composeStringExtras("class", element.getClass_Element(), false);
28201      }
28202      if (element.hasClassDisplayElement()) {
28203        composeStringCore("classDisplay", element.getClassDisplayElement(), false);
28204        composeStringExtras("classDisplay", element.getClassDisplayElement(), false);
28205      }
28206      if (element.hasSubClassElement()) {
28207        composeStringCore("subClass", element.getSubClassElement(), false);
28208        composeStringExtras("subClass", element.getSubClassElement(), false);
28209      }
28210      if (element.hasSubClassDisplayElement()) {
28211        composeStringCore("subClassDisplay", element.getSubClassDisplayElement(), false);
28212        composeStringExtras("subClassDisplay", element.getSubClassDisplayElement(), false);
28213      }
28214  }
28215
28216  protected void composeDataElement(String name, DataElement element) throws IOException {
28217    if (element != null) {
28218      prop("resourceType", name);
28219      composeDataElementInner(element);
28220    }
28221  }
28222
28223  protected void composeDataElementInner(DataElement element) throws IOException {
28224      composeDomainResourceElements(element);
28225      if (element.hasUrlElement()) {
28226        composeUriCore("url", element.getUrlElement(), false);
28227        composeUriExtras("url", element.getUrlElement(), false);
28228      }
28229      if (element.hasIdentifier()) {
28230        openArray("identifier");
28231        for (Identifier e : element.getIdentifier()) 
28232          composeIdentifier(null, e);
28233        closeArray();
28234      };
28235      if (element.hasVersionElement()) {
28236        composeStringCore("version", element.getVersionElement(), false);
28237        composeStringExtras("version", element.getVersionElement(), false);
28238      }
28239      if (element.hasStatusElement()) {
28240        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
28241        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
28242      }
28243      if (element.hasExperimentalElement()) {
28244        composeBooleanCore("experimental", element.getExperimentalElement(), false);
28245        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
28246      }
28247      if (element.hasDateElement()) {
28248        composeDateTimeCore("date", element.getDateElement(), false);
28249        composeDateTimeExtras("date", element.getDateElement(), false);
28250      }
28251      if (element.hasPublisherElement()) {
28252        composeStringCore("publisher", element.getPublisherElement(), false);
28253        composeStringExtras("publisher", element.getPublisherElement(), false);
28254      }
28255      if (element.hasNameElement()) {
28256        composeStringCore("name", element.getNameElement(), false);
28257        composeStringExtras("name", element.getNameElement(), false);
28258      }
28259      if (element.hasTitleElement()) {
28260        composeStringCore("title", element.getTitleElement(), false);
28261        composeStringExtras("title", element.getTitleElement(), false);
28262      }
28263      if (element.hasContact()) {
28264        openArray("contact");
28265        for (ContactDetail e : element.getContact()) 
28266          composeContactDetail(null, e);
28267        closeArray();
28268      };
28269      if (element.hasUseContext()) {
28270        openArray("useContext");
28271        for (UsageContext e : element.getUseContext()) 
28272          composeUsageContext(null, e);
28273        closeArray();
28274      };
28275      if (element.hasJurisdiction()) {
28276        openArray("jurisdiction");
28277        for (CodeableConcept e : element.getJurisdiction()) 
28278          composeCodeableConcept(null, e);
28279        closeArray();
28280      };
28281      if (element.hasCopyrightElement()) {
28282        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
28283        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
28284      }
28285      if (element.hasStringencyElement()) {
28286        composeEnumerationCore("stringency", element.getStringencyElement(), new DataElement.DataElementStringencyEnumFactory(), false);
28287        composeEnumerationExtras("stringency", element.getStringencyElement(), new DataElement.DataElementStringencyEnumFactory(), false);
28288      }
28289      if (element.hasMapping()) {
28290        openArray("mapping");
28291        for (DataElement.DataElementMappingComponent e : element.getMapping()) 
28292          composeDataElementDataElementMappingComponent(null, e);
28293        closeArray();
28294      };
28295      if (element.hasElement()) {
28296        openArray("element");
28297        for (ElementDefinition e : element.getElement()) 
28298          composeElementDefinition(null, e);
28299        closeArray();
28300      };
28301  }
28302
28303  protected void composeDataElementDataElementMappingComponent(String name, DataElement.DataElementMappingComponent element) throws IOException {
28304    if (element != null) {
28305      open(name);
28306      composeDataElementDataElementMappingComponentInner(element);
28307      close();
28308    }
28309  }
28310
28311  protected void composeDataElementDataElementMappingComponentInner(DataElement.DataElementMappingComponent element) throws IOException {
28312      composeBackbone(element);
28313      if (element.hasIdentityElement()) {
28314        composeIdCore("identity", element.getIdentityElement(), false);
28315        composeIdExtras("identity", element.getIdentityElement(), false);
28316      }
28317      if (element.hasUriElement()) {
28318        composeUriCore("uri", element.getUriElement(), false);
28319        composeUriExtras("uri", element.getUriElement(), false);
28320      }
28321      if (element.hasNameElement()) {
28322        composeStringCore("name", element.getNameElement(), false);
28323        composeStringExtras("name", element.getNameElement(), false);
28324      }
28325      if (element.hasCommentElement()) {
28326        composeStringCore("comment", element.getCommentElement(), false);
28327        composeStringExtras("comment", element.getCommentElement(), false);
28328      }
28329  }
28330
28331  protected void composeDetectedIssue(String name, DetectedIssue element) throws IOException {
28332    if (element != null) {
28333      prop("resourceType", name);
28334      composeDetectedIssueInner(element);
28335    }
28336  }
28337
28338  protected void composeDetectedIssueInner(DetectedIssue element) throws IOException {
28339      composeDomainResourceElements(element);
28340      if (element.hasIdentifier()) {
28341        composeIdentifier("identifier", element.getIdentifier());
28342      }
28343      if (element.hasStatusElement()) {
28344        composeEnumerationCore("status", element.getStatusElement(), new DetectedIssue.DetectedIssueStatusEnumFactory(), false);
28345        composeEnumerationExtras("status", element.getStatusElement(), new DetectedIssue.DetectedIssueStatusEnumFactory(), false);
28346      }
28347      if (element.hasCategory()) {
28348        composeCodeableConcept("category", element.getCategory());
28349      }
28350      if (element.hasSeverityElement()) {
28351        composeEnumerationCore("severity", element.getSeverityElement(), new DetectedIssue.DetectedIssueSeverityEnumFactory(), false);
28352        composeEnumerationExtras("severity", element.getSeverityElement(), new DetectedIssue.DetectedIssueSeverityEnumFactory(), false);
28353      }
28354      if (element.hasPatient()) {
28355        composeReference("patient", element.getPatient());
28356      }
28357      if (element.hasDateElement()) {
28358        composeDateTimeCore("date", element.getDateElement(), false);
28359        composeDateTimeExtras("date", element.getDateElement(), false);
28360      }
28361      if (element.hasAuthor()) {
28362        composeReference("author", element.getAuthor());
28363      }
28364      if (element.hasImplicated()) {
28365        openArray("implicated");
28366        for (Reference e : element.getImplicated()) 
28367          composeReference(null, e);
28368        closeArray();
28369      };
28370      if (element.hasDetailElement()) {
28371        composeStringCore("detail", element.getDetailElement(), false);
28372        composeStringExtras("detail", element.getDetailElement(), false);
28373      }
28374      if (element.hasReferenceElement()) {
28375        composeUriCore("reference", element.getReferenceElement(), false);
28376        composeUriExtras("reference", element.getReferenceElement(), false);
28377      }
28378      if (element.hasMitigation()) {
28379        openArray("mitigation");
28380        for (DetectedIssue.DetectedIssueMitigationComponent e : element.getMitigation()) 
28381          composeDetectedIssueDetectedIssueMitigationComponent(null, e);
28382        closeArray();
28383      };
28384  }
28385
28386  protected void composeDetectedIssueDetectedIssueMitigationComponent(String name, DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
28387    if (element != null) {
28388      open(name);
28389      composeDetectedIssueDetectedIssueMitigationComponentInner(element);
28390      close();
28391    }
28392  }
28393
28394  protected void composeDetectedIssueDetectedIssueMitigationComponentInner(DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
28395      composeBackbone(element);
28396      if (element.hasAction()) {
28397        composeCodeableConcept("action", element.getAction());
28398      }
28399      if (element.hasDateElement()) {
28400        composeDateTimeCore("date", element.getDateElement(), false);
28401        composeDateTimeExtras("date", element.getDateElement(), false);
28402      }
28403      if (element.hasAuthor()) {
28404        composeReference("author", element.getAuthor());
28405      }
28406  }
28407
28408  protected void composeDevice(String name, Device element) throws IOException {
28409    if (element != null) {
28410      prop("resourceType", name);
28411      composeDeviceInner(element);
28412    }
28413  }
28414
28415  protected void composeDeviceInner(Device element) throws IOException {
28416      composeDomainResourceElements(element);
28417      if (element.hasIdentifier()) {
28418        openArray("identifier");
28419        for (Identifier e : element.getIdentifier()) 
28420          composeIdentifier(null, e);
28421        closeArray();
28422      };
28423      if (element.hasUdi()) {
28424        composeDeviceDeviceUdiComponent("udi", element.getUdi());
28425      }
28426      if (element.hasStatusElement()) {
28427        composeEnumerationCore("status", element.getStatusElement(), new Device.FHIRDeviceStatusEnumFactory(), false);
28428        composeEnumerationExtras("status", element.getStatusElement(), new Device.FHIRDeviceStatusEnumFactory(), false);
28429      }
28430      if (element.hasType()) {
28431        composeCodeableConcept("type", element.getType());
28432      }
28433      if (element.hasLotNumberElement()) {
28434        composeStringCore("lotNumber", element.getLotNumberElement(), false);
28435        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
28436      }
28437      if (element.hasManufacturerElement()) {
28438        composeStringCore("manufacturer", element.getManufacturerElement(), false);
28439        composeStringExtras("manufacturer", element.getManufacturerElement(), false);
28440      }
28441      if (element.hasManufactureDateElement()) {
28442        composeDateTimeCore("manufactureDate", element.getManufactureDateElement(), false);
28443        composeDateTimeExtras("manufactureDate", element.getManufactureDateElement(), false);
28444      }
28445      if (element.hasExpirationDateElement()) {
28446        composeDateTimeCore("expirationDate", element.getExpirationDateElement(), false);
28447        composeDateTimeExtras("expirationDate", element.getExpirationDateElement(), false);
28448      }
28449      if (element.hasModelElement()) {
28450        composeStringCore("model", element.getModelElement(), false);
28451        composeStringExtras("model", element.getModelElement(), false);
28452      }
28453      if (element.hasVersionElement()) {
28454        composeStringCore("version", element.getVersionElement(), false);
28455        composeStringExtras("version", element.getVersionElement(), false);
28456      }
28457      if (element.hasPatient()) {
28458        composeReference("patient", element.getPatient());
28459      }
28460      if (element.hasOwner()) {
28461        composeReference("owner", element.getOwner());
28462      }
28463      if (element.hasContact()) {
28464        openArray("contact");
28465        for (ContactPoint e : element.getContact()) 
28466          composeContactPoint(null, e);
28467        closeArray();
28468      };
28469      if (element.hasLocation()) {
28470        composeReference("location", element.getLocation());
28471      }
28472      if (element.hasUrlElement()) {
28473        composeUriCore("url", element.getUrlElement(), false);
28474        composeUriExtras("url", element.getUrlElement(), false);
28475      }
28476      if (element.hasNote()) {
28477        openArray("note");
28478        for (Annotation e : element.getNote()) 
28479          composeAnnotation(null, e);
28480        closeArray();
28481      };
28482      if (element.hasSafety()) {
28483        openArray("safety");
28484        for (CodeableConcept e : element.getSafety()) 
28485          composeCodeableConcept(null, e);
28486        closeArray();
28487      };
28488  }
28489
28490  protected void composeDeviceDeviceUdiComponent(String name, Device.DeviceUdiComponent element) throws IOException {
28491    if (element != null) {
28492      open(name);
28493      composeDeviceDeviceUdiComponentInner(element);
28494      close();
28495    }
28496  }
28497
28498  protected void composeDeviceDeviceUdiComponentInner(Device.DeviceUdiComponent element) throws IOException {
28499      composeBackbone(element);
28500      if (element.hasDeviceIdentifierElement()) {
28501        composeStringCore("deviceIdentifier", element.getDeviceIdentifierElement(), false);
28502        composeStringExtras("deviceIdentifier", element.getDeviceIdentifierElement(), false);
28503      }
28504      if (element.hasNameElement()) {
28505        composeStringCore("name", element.getNameElement(), false);
28506        composeStringExtras("name", element.getNameElement(), false);
28507      }
28508      if (element.hasJurisdictionElement()) {
28509        composeUriCore("jurisdiction", element.getJurisdictionElement(), false);
28510        composeUriExtras("jurisdiction", element.getJurisdictionElement(), false);
28511      }
28512      if (element.hasCarrierHRFElement()) {
28513        composeStringCore("carrierHRF", element.getCarrierHRFElement(), false);
28514        composeStringExtras("carrierHRF", element.getCarrierHRFElement(), false);
28515      }
28516      if (element.hasCarrierAIDCElement()) {
28517        composeBase64BinaryCore("carrierAIDC", element.getCarrierAIDCElement(), false);
28518        composeBase64BinaryExtras("carrierAIDC", element.getCarrierAIDCElement(), false);
28519      }
28520      if (element.hasIssuerElement()) {
28521        composeUriCore("issuer", element.getIssuerElement(), false);
28522        composeUriExtras("issuer", element.getIssuerElement(), false);
28523      }
28524      if (element.hasEntryTypeElement()) {
28525        composeEnumerationCore("entryType", element.getEntryTypeElement(), new Device.UDIEntryTypeEnumFactory(), false);
28526        composeEnumerationExtras("entryType", element.getEntryTypeElement(), new Device.UDIEntryTypeEnumFactory(), false);
28527      }
28528  }
28529
28530  protected void composeDeviceComponent(String name, DeviceComponent element) throws IOException {
28531    if (element != null) {
28532      prop("resourceType", name);
28533      composeDeviceComponentInner(element);
28534    }
28535  }
28536
28537  protected void composeDeviceComponentInner(DeviceComponent element) throws IOException {
28538      composeDomainResourceElements(element);
28539      if (element.hasIdentifier()) {
28540        composeIdentifier("identifier", element.getIdentifier());
28541      }
28542      if (element.hasType()) {
28543        composeCodeableConcept("type", element.getType());
28544      }
28545      if (element.hasLastSystemChangeElement()) {
28546        composeInstantCore("lastSystemChange", element.getLastSystemChangeElement(), false);
28547        composeInstantExtras("lastSystemChange", element.getLastSystemChangeElement(), false);
28548      }
28549      if (element.hasSource()) {
28550        composeReference("source", element.getSource());
28551      }
28552      if (element.hasParent()) {
28553        composeReference("parent", element.getParent());
28554      }
28555      if (element.hasOperationalStatus()) {
28556        openArray("operationalStatus");
28557        for (CodeableConcept e : element.getOperationalStatus()) 
28558          composeCodeableConcept(null, e);
28559        closeArray();
28560      };
28561      if (element.hasParameterGroup()) {
28562        composeCodeableConcept("parameterGroup", element.getParameterGroup());
28563      }
28564      if (element.hasMeasurementPrincipleElement()) {
28565        composeEnumerationCore("measurementPrinciple", element.getMeasurementPrincipleElement(), new DeviceComponent.MeasmntPrincipleEnumFactory(), false);
28566        composeEnumerationExtras("measurementPrinciple", element.getMeasurementPrincipleElement(), new DeviceComponent.MeasmntPrincipleEnumFactory(), false);
28567      }
28568      if (element.hasProductionSpecification()) {
28569        openArray("productionSpecification");
28570        for (DeviceComponent.DeviceComponentProductionSpecificationComponent e : element.getProductionSpecification()) 
28571          composeDeviceComponentDeviceComponentProductionSpecificationComponent(null, e);
28572        closeArray();
28573      };
28574      if (element.hasLanguageCode()) {
28575        composeCodeableConcept("languageCode", element.getLanguageCode());
28576      }
28577  }
28578
28579  protected void composeDeviceComponentDeviceComponentProductionSpecificationComponent(String name, DeviceComponent.DeviceComponentProductionSpecificationComponent element) throws IOException {
28580    if (element != null) {
28581      open(name);
28582      composeDeviceComponentDeviceComponentProductionSpecificationComponentInner(element);
28583      close();
28584    }
28585  }
28586
28587  protected void composeDeviceComponentDeviceComponentProductionSpecificationComponentInner(DeviceComponent.DeviceComponentProductionSpecificationComponent element) throws IOException {
28588      composeBackbone(element);
28589      if (element.hasSpecType()) {
28590        composeCodeableConcept("specType", element.getSpecType());
28591      }
28592      if (element.hasComponentId()) {
28593        composeIdentifier("componentId", element.getComponentId());
28594      }
28595      if (element.hasProductionSpecElement()) {
28596        composeStringCore("productionSpec", element.getProductionSpecElement(), false);
28597        composeStringExtras("productionSpec", element.getProductionSpecElement(), false);
28598      }
28599  }
28600
28601  protected void composeDeviceMetric(String name, DeviceMetric element) throws IOException {
28602    if (element != null) {
28603      prop("resourceType", name);
28604      composeDeviceMetricInner(element);
28605    }
28606  }
28607
28608  protected void composeDeviceMetricInner(DeviceMetric element) throws IOException {
28609      composeDomainResourceElements(element);
28610      if (element.hasIdentifier()) {
28611        composeIdentifier("identifier", element.getIdentifier());
28612      }
28613      if (element.hasType()) {
28614        composeCodeableConcept("type", element.getType());
28615      }
28616      if (element.hasUnit()) {
28617        composeCodeableConcept("unit", element.getUnit());
28618      }
28619      if (element.hasSource()) {
28620        composeReference("source", element.getSource());
28621      }
28622      if (element.hasParent()) {
28623        composeReference("parent", element.getParent());
28624      }
28625      if (element.hasOperationalStatusElement()) {
28626        composeEnumerationCore("operationalStatus", element.getOperationalStatusElement(), new DeviceMetric.DeviceMetricOperationalStatusEnumFactory(), false);
28627        composeEnumerationExtras("operationalStatus", element.getOperationalStatusElement(), new DeviceMetric.DeviceMetricOperationalStatusEnumFactory(), false);
28628      }
28629      if (element.hasColorElement()) {
28630        composeEnumerationCore("color", element.getColorElement(), new DeviceMetric.DeviceMetricColorEnumFactory(), false);
28631        composeEnumerationExtras("color", element.getColorElement(), new DeviceMetric.DeviceMetricColorEnumFactory(), false);
28632      }
28633      if (element.hasCategoryElement()) {
28634        composeEnumerationCore("category", element.getCategoryElement(), new DeviceMetric.DeviceMetricCategoryEnumFactory(), false);
28635        composeEnumerationExtras("category", element.getCategoryElement(), new DeviceMetric.DeviceMetricCategoryEnumFactory(), false);
28636      }
28637      if (element.hasMeasurementPeriod()) {
28638        composeTiming("measurementPeriod", element.getMeasurementPeriod());
28639      }
28640      if (element.hasCalibration()) {
28641        openArray("calibration");
28642        for (DeviceMetric.DeviceMetricCalibrationComponent e : element.getCalibration()) 
28643          composeDeviceMetricDeviceMetricCalibrationComponent(null, e);
28644        closeArray();
28645      };
28646  }
28647
28648  protected void composeDeviceMetricDeviceMetricCalibrationComponent(String name, DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
28649    if (element != null) {
28650      open(name);
28651      composeDeviceMetricDeviceMetricCalibrationComponentInner(element);
28652      close();
28653    }
28654  }
28655
28656  protected void composeDeviceMetricDeviceMetricCalibrationComponentInner(DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
28657      composeBackbone(element);
28658      if (element.hasTypeElement()) {
28659        composeEnumerationCore("type", element.getTypeElement(), new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory(), false);
28660        composeEnumerationExtras("type", element.getTypeElement(), new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory(), false);
28661      }
28662      if (element.hasStateElement()) {
28663        composeEnumerationCore("state", element.getStateElement(), new DeviceMetric.DeviceMetricCalibrationStateEnumFactory(), false);
28664        composeEnumerationExtras("state", element.getStateElement(), new DeviceMetric.DeviceMetricCalibrationStateEnumFactory(), false);
28665      }
28666      if (element.hasTimeElement()) {
28667        composeInstantCore("time", element.getTimeElement(), false);
28668        composeInstantExtras("time", element.getTimeElement(), false);
28669      }
28670  }
28671
28672  protected void composeDeviceRequest(String name, DeviceRequest element) throws IOException {
28673    if (element != null) {
28674      prop("resourceType", name);
28675      composeDeviceRequestInner(element);
28676    }
28677  }
28678
28679  protected void composeDeviceRequestInner(DeviceRequest element) throws IOException {
28680      composeDomainResourceElements(element);
28681      if (element.hasIdentifier()) {
28682        openArray("identifier");
28683        for (Identifier e : element.getIdentifier()) 
28684          composeIdentifier(null, e);
28685        closeArray();
28686      };
28687      if (element.hasDefinition()) {
28688        openArray("definition");
28689        for (Reference e : element.getDefinition()) 
28690          composeReference(null, e);
28691        closeArray();
28692      };
28693      if (element.hasBasedOn()) {
28694        openArray("basedOn");
28695        for (Reference e : element.getBasedOn()) 
28696          composeReference(null, e);
28697        closeArray();
28698      };
28699      if (element.hasPriorRequest()) {
28700        openArray("priorRequest");
28701        for (Reference e : element.getPriorRequest()) 
28702          composeReference(null, e);
28703        closeArray();
28704      };
28705      if (element.hasGroupIdentifier()) {
28706        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
28707      }
28708      if (element.hasStatusElement()) {
28709        composeEnumerationCore("status", element.getStatusElement(), new DeviceRequest.DeviceRequestStatusEnumFactory(), false);
28710        composeEnumerationExtras("status", element.getStatusElement(), new DeviceRequest.DeviceRequestStatusEnumFactory(), false);
28711      }
28712      if (element.hasIntent()) {
28713        composeCodeableConcept("intent", element.getIntent());
28714      }
28715      if (element.hasPriorityElement()) {
28716        composeEnumerationCore("priority", element.getPriorityElement(), new DeviceRequest.RequestPriorityEnumFactory(), false);
28717        composeEnumerationExtras("priority", element.getPriorityElement(), new DeviceRequest.RequestPriorityEnumFactory(), false);
28718      }
28719      if (element.hasCode()) {
28720        composeType("code", element.getCode());
28721      }
28722      if (element.hasSubject()) {
28723        composeReference("subject", element.getSubject());
28724      }
28725      if (element.hasContext()) {
28726        composeReference("context", element.getContext());
28727      }
28728      if (element.hasOccurrence()) {
28729        composeType("occurrence", element.getOccurrence());
28730      }
28731      if (element.hasAuthoredOnElement()) {
28732        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
28733        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
28734      }
28735      if (element.hasRequester()) {
28736        composeDeviceRequestDeviceRequestRequesterComponent("requester", element.getRequester());
28737      }
28738      if (element.hasPerformerType()) {
28739        composeCodeableConcept("performerType", element.getPerformerType());
28740      }
28741      if (element.hasPerformer()) {
28742        composeReference("performer", element.getPerformer());
28743      }
28744      if (element.hasReasonCode()) {
28745        openArray("reasonCode");
28746        for (CodeableConcept e : element.getReasonCode()) 
28747          composeCodeableConcept(null, e);
28748        closeArray();
28749      };
28750      if (element.hasReasonReference()) {
28751        openArray("reasonReference");
28752        for (Reference e : element.getReasonReference()) 
28753          composeReference(null, e);
28754        closeArray();
28755      };
28756      if (element.hasSupportingInfo()) {
28757        openArray("supportingInfo");
28758        for (Reference e : element.getSupportingInfo()) 
28759          composeReference(null, e);
28760        closeArray();
28761      };
28762      if (element.hasNote()) {
28763        openArray("note");
28764        for (Annotation e : element.getNote()) 
28765          composeAnnotation(null, e);
28766        closeArray();
28767      };
28768      if (element.hasRelevantHistory()) {
28769        openArray("relevantHistory");
28770        for (Reference e : element.getRelevantHistory()) 
28771          composeReference(null, e);
28772        closeArray();
28773      };
28774  }
28775
28776  protected void composeDeviceRequestDeviceRequestRequesterComponent(String name, DeviceRequest.DeviceRequestRequesterComponent element) throws IOException {
28777    if (element != null) {
28778      open(name);
28779      composeDeviceRequestDeviceRequestRequesterComponentInner(element);
28780      close();
28781    }
28782  }
28783
28784  protected void composeDeviceRequestDeviceRequestRequesterComponentInner(DeviceRequest.DeviceRequestRequesterComponent element) throws IOException {
28785      composeBackbone(element);
28786      if (element.hasAgent()) {
28787        composeReference("agent", element.getAgent());
28788      }
28789      if (element.hasOnBehalfOf()) {
28790        composeReference("onBehalfOf", element.getOnBehalfOf());
28791      }
28792  }
28793
28794  protected void composeDeviceUseStatement(String name, DeviceUseStatement element) throws IOException {
28795    if (element != null) {
28796      prop("resourceType", name);
28797      composeDeviceUseStatementInner(element);
28798    }
28799  }
28800
28801  protected void composeDeviceUseStatementInner(DeviceUseStatement element) throws IOException {
28802      composeDomainResourceElements(element);
28803      if (element.hasIdentifier()) {
28804        openArray("identifier");
28805        for (Identifier e : element.getIdentifier()) 
28806          composeIdentifier(null, e);
28807        closeArray();
28808      };
28809      if (element.hasStatusElement()) {
28810        composeEnumerationCore("status", element.getStatusElement(), new DeviceUseStatement.DeviceUseStatementStatusEnumFactory(), false);
28811        composeEnumerationExtras("status", element.getStatusElement(), new DeviceUseStatement.DeviceUseStatementStatusEnumFactory(), false);
28812      }
28813      if (element.hasSubject()) {
28814        composeReference("subject", element.getSubject());
28815      }
28816      if (element.hasWhenUsed()) {
28817        composePeriod("whenUsed", element.getWhenUsed());
28818      }
28819      if (element.hasTiming()) {
28820        composeType("timing", element.getTiming());
28821      }
28822      if (element.hasRecordedOnElement()) {
28823        composeDateTimeCore("recordedOn", element.getRecordedOnElement(), false);
28824        composeDateTimeExtras("recordedOn", element.getRecordedOnElement(), false);
28825      }
28826      if (element.hasSource()) {
28827        composeReference("source", element.getSource());
28828      }
28829      if (element.hasDevice()) {
28830        composeReference("device", element.getDevice());
28831      }
28832      if (element.hasIndication()) {
28833        openArray("indication");
28834        for (CodeableConcept e : element.getIndication()) 
28835          composeCodeableConcept(null, e);
28836        closeArray();
28837      };
28838      if (element.hasBodySite()) {
28839        composeCodeableConcept("bodySite", element.getBodySite());
28840      }
28841      if (element.hasNote()) {
28842        openArray("note");
28843        for (Annotation e : element.getNote()) 
28844          composeAnnotation(null, e);
28845        closeArray();
28846      };
28847  }
28848
28849  protected void composeDiagnosticReport(String name, DiagnosticReport element) throws IOException {
28850    if (element != null) {
28851      prop("resourceType", name);
28852      composeDiagnosticReportInner(element);
28853    }
28854  }
28855
28856  protected void composeDiagnosticReportInner(DiagnosticReport element) throws IOException {
28857      composeDomainResourceElements(element);
28858      if (element.hasIdentifier()) {
28859        openArray("identifier");
28860        for (Identifier e : element.getIdentifier()) 
28861          composeIdentifier(null, e);
28862        closeArray();
28863      };
28864      if (element.hasBasedOn()) {
28865        openArray("basedOn");
28866        for (Reference e : element.getBasedOn()) 
28867          composeReference(null, e);
28868        closeArray();
28869      };
28870      if (element.hasStatusElement()) {
28871        composeEnumerationCore("status", element.getStatusElement(), new DiagnosticReport.DiagnosticReportStatusEnumFactory(), false);
28872        composeEnumerationExtras("status", element.getStatusElement(), new DiagnosticReport.DiagnosticReportStatusEnumFactory(), false);
28873      }
28874      if (element.hasCategory()) {
28875        composeCodeableConcept("category", element.getCategory());
28876      }
28877      if (element.hasCode()) {
28878        composeCodeableConcept("code", element.getCode());
28879      }
28880      if (element.hasSubject()) {
28881        composeReference("subject", element.getSubject());
28882      }
28883      if (element.hasContext()) {
28884        composeReference("context", element.getContext());
28885      }
28886      if (element.hasEffective()) {
28887        composeType("effective", element.getEffective());
28888      }
28889      if (element.hasIssuedElement()) {
28890        composeInstantCore("issued", element.getIssuedElement(), false);
28891        composeInstantExtras("issued", element.getIssuedElement(), false);
28892      }
28893      if (element.hasPerformer()) {
28894        openArray("performer");
28895        for (DiagnosticReport.DiagnosticReportPerformerComponent e : element.getPerformer()) 
28896          composeDiagnosticReportDiagnosticReportPerformerComponent(null, e);
28897        closeArray();
28898      };
28899      if (element.hasSpecimen()) {
28900        openArray("specimen");
28901        for (Reference e : element.getSpecimen()) 
28902          composeReference(null, e);
28903        closeArray();
28904      };
28905      if (element.hasResult()) {
28906        openArray("result");
28907        for (Reference e : element.getResult()) 
28908          composeReference(null, e);
28909        closeArray();
28910      };
28911      if (element.hasImagingStudy()) {
28912        openArray("imagingStudy");
28913        for (Reference e : element.getImagingStudy()) 
28914          composeReference(null, e);
28915        closeArray();
28916      };
28917      if (element.hasImage()) {
28918        openArray("image");
28919        for (DiagnosticReport.DiagnosticReportImageComponent e : element.getImage()) 
28920          composeDiagnosticReportDiagnosticReportImageComponent(null, e);
28921        closeArray();
28922      };
28923      if (element.hasConclusionElement()) {
28924        composeStringCore("conclusion", element.getConclusionElement(), false);
28925        composeStringExtras("conclusion", element.getConclusionElement(), false);
28926      }
28927      if (element.hasCodedDiagnosis()) {
28928        openArray("codedDiagnosis");
28929        for (CodeableConcept e : element.getCodedDiagnosis()) 
28930          composeCodeableConcept(null, e);
28931        closeArray();
28932      };
28933      if (element.hasPresentedForm()) {
28934        openArray("presentedForm");
28935        for (Attachment e : element.getPresentedForm()) 
28936          composeAttachment(null, e);
28937        closeArray();
28938      };
28939  }
28940
28941  protected void composeDiagnosticReportDiagnosticReportPerformerComponent(String name, DiagnosticReport.DiagnosticReportPerformerComponent element) throws IOException {
28942    if (element != null) {
28943      open(name);
28944      composeDiagnosticReportDiagnosticReportPerformerComponentInner(element);
28945      close();
28946    }
28947  }
28948
28949  protected void composeDiagnosticReportDiagnosticReportPerformerComponentInner(DiagnosticReport.DiagnosticReportPerformerComponent element) throws IOException {
28950      composeBackbone(element);
28951      if (element.hasRole()) {
28952        composeCodeableConcept("role", element.getRole());
28953      }
28954      if (element.hasActor()) {
28955        composeReference("actor", element.getActor());
28956      }
28957  }
28958
28959  protected void composeDiagnosticReportDiagnosticReportImageComponent(String name, DiagnosticReport.DiagnosticReportImageComponent element) throws IOException {
28960    if (element != null) {
28961      open(name);
28962      composeDiagnosticReportDiagnosticReportImageComponentInner(element);
28963      close();
28964    }
28965  }
28966
28967  protected void composeDiagnosticReportDiagnosticReportImageComponentInner(DiagnosticReport.DiagnosticReportImageComponent element) throws IOException {
28968      composeBackbone(element);
28969      if (element.hasCommentElement()) {
28970        composeStringCore("comment", element.getCommentElement(), false);
28971        composeStringExtras("comment", element.getCommentElement(), false);
28972      }
28973      if (element.hasLink()) {
28974        composeReference("link", element.getLink());
28975      }
28976  }
28977
28978  protected void composeDocumentManifest(String name, DocumentManifest element) throws IOException {
28979    if (element != null) {
28980      prop("resourceType", name);
28981      composeDocumentManifestInner(element);
28982    }
28983  }
28984
28985  protected void composeDocumentManifestInner(DocumentManifest element) throws IOException {
28986      composeDomainResourceElements(element);
28987      if (element.hasMasterIdentifier()) {
28988        composeIdentifier("masterIdentifier", element.getMasterIdentifier());
28989      }
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 Enumerations.DocumentReferenceStatusEnumFactory(), false);
28998        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
28999      }
29000      if (element.hasType()) {
29001        composeCodeableConcept("type", element.getType());
29002      }
29003      if (element.hasSubject()) {
29004        composeReference("subject", element.getSubject());
29005      }
29006      if (element.hasCreatedElement()) {
29007        composeDateTimeCore("created", element.getCreatedElement(), false);
29008        composeDateTimeExtras("created", element.getCreatedElement(), false);
29009      }
29010      if (element.hasAuthor()) {
29011        openArray("author");
29012        for (Reference e : element.getAuthor()) 
29013          composeReference(null, e);
29014        closeArray();
29015      };
29016      if (element.hasRecipient()) {
29017        openArray("recipient");
29018        for (Reference e : element.getRecipient()) 
29019          composeReference(null, e);
29020        closeArray();
29021      };
29022      if (element.hasSourceElement()) {
29023        composeUriCore("source", element.getSourceElement(), false);
29024        composeUriExtras("source", element.getSourceElement(), false);
29025      }
29026      if (element.hasDescriptionElement()) {
29027        composeStringCore("description", element.getDescriptionElement(), false);
29028        composeStringExtras("description", element.getDescriptionElement(), false);
29029      }
29030      if (element.hasContent()) {
29031        openArray("content");
29032        for (DocumentManifest.DocumentManifestContentComponent e : element.getContent()) 
29033          composeDocumentManifestDocumentManifestContentComponent(null, e);
29034        closeArray();
29035      };
29036      if (element.hasRelated()) {
29037        openArray("related");
29038        for (DocumentManifest.DocumentManifestRelatedComponent e : element.getRelated()) 
29039          composeDocumentManifestDocumentManifestRelatedComponent(null, e);
29040        closeArray();
29041      };
29042  }
29043
29044  protected void composeDocumentManifestDocumentManifestContentComponent(String name, DocumentManifest.DocumentManifestContentComponent element) throws IOException {
29045    if (element != null) {
29046      open(name);
29047      composeDocumentManifestDocumentManifestContentComponentInner(element);
29048      close();
29049    }
29050  }
29051
29052  protected void composeDocumentManifestDocumentManifestContentComponentInner(DocumentManifest.DocumentManifestContentComponent element) throws IOException {
29053      composeBackbone(element);
29054      if (element.hasP()) {
29055        composeType("p", element.getP());
29056      }
29057  }
29058
29059  protected void composeDocumentManifestDocumentManifestRelatedComponent(String name, DocumentManifest.DocumentManifestRelatedComponent element) throws IOException {
29060    if (element != null) {
29061      open(name);
29062      composeDocumentManifestDocumentManifestRelatedComponentInner(element);
29063      close();
29064    }
29065  }
29066
29067  protected void composeDocumentManifestDocumentManifestRelatedComponentInner(DocumentManifest.DocumentManifestRelatedComponent element) throws IOException {
29068      composeBackbone(element);
29069      if (element.hasIdentifier()) {
29070        composeIdentifier("identifier", element.getIdentifier());
29071      }
29072      if (element.hasRef()) {
29073        composeReference("ref", element.getRef());
29074      }
29075  }
29076
29077  protected void composeDocumentReference(String name, DocumentReference element) throws IOException {
29078    if (element != null) {
29079      prop("resourceType", name);
29080      composeDocumentReferenceInner(element);
29081    }
29082  }
29083
29084  protected void composeDocumentReferenceInner(DocumentReference element) throws IOException {
29085      composeDomainResourceElements(element);
29086      if (element.hasMasterIdentifier()) {
29087        composeIdentifier("masterIdentifier", element.getMasterIdentifier());
29088      }
29089      if (element.hasIdentifier()) {
29090        openArray("identifier");
29091        for (Identifier e : element.getIdentifier()) 
29092          composeIdentifier(null, e);
29093        closeArray();
29094      };
29095      if (element.hasStatusElement()) {
29096        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
29097        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
29098      }
29099      if (element.hasDocStatusElement()) {
29100        composeEnumerationCore("docStatus", element.getDocStatusElement(), new DocumentReference.ReferredDocumentStatusEnumFactory(), false);
29101        composeEnumerationExtras("docStatus", element.getDocStatusElement(), new DocumentReference.ReferredDocumentStatusEnumFactory(), false);
29102      }
29103      if (element.hasType()) {
29104        composeCodeableConcept("type", element.getType());
29105      }
29106      if (element.hasClass_()) {
29107        composeCodeableConcept("class", element.getClass_());
29108      }
29109      if (element.hasSubject()) {
29110        composeReference("subject", element.getSubject());
29111      }
29112      if (element.hasCreatedElement()) {
29113        composeDateTimeCore("created", element.getCreatedElement(), false);
29114        composeDateTimeExtras("created", element.getCreatedElement(), false);
29115      }
29116      if (element.hasIndexedElement()) {
29117        composeInstantCore("indexed", element.getIndexedElement(), false);
29118        composeInstantExtras("indexed", element.getIndexedElement(), false);
29119      }
29120      if (element.hasAuthor()) {
29121        openArray("author");
29122        for (Reference e : element.getAuthor()) 
29123          composeReference(null, e);
29124        closeArray();
29125      };
29126      if (element.hasAuthenticator()) {
29127        composeReference("authenticator", element.getAuthenticator());
29128      }
29129      if (element.hasCustodian()) {
29130        composeReference("custodian", element.getCustodian());
29131      }
29132      if (element.hasRelatesTo()) {
29133        openArray("relatesTo");
29134        for (DocumentReference.DocumentReferenceRelatesToComponent e : element.getRelatesTo()) 
29135          composeDocumentReferenceDocumentReferenceRelatesToComponent(null, e);
29136        closeArray();
29137      };
29138      if (element.hasDescriptionElement()) {
29139        composeStringCore("description", element.getDescriptionElement(), false);
29140        composeStringExtras("description", element.getDescriptionElement(), false);
29141      }
29142      if (element.hasSecurityLabel()) {
29143        openArray("securityLabel");
29144        for (CodeableConcept e : element.getSecurityLabel()) 
29145          composeCodeableConcept(null, e);
29146        closeArray();
29147      };
29148      if (element.hasContent()) {
29149        openArray("content");
29150        for (DocumentReference.DocumentReferenceContentComponent e : element.getContent()) 
29151          composeDocumentReferenceDocumentReferenceContentComponent(null, e);
29152        closeArray();
29153      };
29154      if (element.hasContext()) {
29155        composeDocumentReferenceDocumentReferenceContextComponent("context", element.getContext());
29156      }
29157  }
29158
29159  protected void composeDocumentReferenceDocumentReferenceRelatesToComponent(String name, DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
29160    if (element != null) {
29161      open(name);
29162      composeDocumentReferenceDocumentReferenceRelatesToComponentInner(element);
29163      close();
29164    }
29165  }
29166
29167  protected void composeDocumentReferenceDocumentReferenceRelatesToComponentInner(DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
29168      composeBackbone(element);
29169      if (element.hasCodeElement()) {
29170        composeEnumerationCore("code", element.getCodeElement(), new DocumentReference.DocumentRelationshipTypeEnumFactory(), false);
29171        composeEnumerationExtras("code", element.getCodeElement(), new DocumentReference.DocumentRelationshipTypeEnumFactory(), false);
29172      }
29173      if (element.hasTarget()) {
29174        composeReference("target", element.getTarget());
29175      }
29176  }
29177
29178  protected void composeDocumentReferenceDocumentReferenceContentComponent(String name, DocumentReference.DocumentReferenceContentComponent element) throws IOException {
29179    if (element != null) {
29180      open(name);
29181      composeDocumentReferenceDocumentReferenceContentComponentInner(element);
29182      close();
29183    }
29184  }
29185
29186  protected void composeDocumentReferenceDocumentReferenceContentComponentInner(DocumentReference.DocumentReferenceContentComponent element) throws IOException {
29187      composeBackbone(element);
29188      if (element.hasAttachment()) {
29189        composeAttachment("attachment", element.getAttachment());
29190      }
29191      if (element.hasFormat()) {
29192        composeCoding("format", element.getFormat());
29193      }
29194  }
29195
29196  protected void composeDocumentReferenceDocumentReferenceContextComponent(String name, DocumentReference.DocumentReferenceContextComponent element) throws IOException {
29197    if (element != null) {
29198      open(name);
29199      composeDocumentReferenceDocumentReferenceContextComponentInner(element);
29200      close();
29201    }
29202  }
29203
29204  protected void composeDocumentReferenceDocumentReferenceContextComponentInner(DocumentReference.DocumentReferenceContextComponent element) throws IOException {
29205      composeBackbone(element);
29206      if (element.hasEncounter()) {
29207        composeReference("encounter", element.getEncounter());
29208      }
29209      if (element.hasEvent()) {
29210        openArray("event");
29211        for (CodeableConcept e : element.getEvent()) 
29212          composeCodeableConcept(null, e);
29213        closeArray();
29214      };
29215      if (element.hasPeriod()) {
29216        composePeriod("period", element.getPeriod());
29217      }
29218      if (element.hasFacilityType()) {
29219        composeCodeableConcept("facilityType", element.getFacilityType());
29220      }
29221      if (element.hasPracticeSetting()) {
29222        composeCodeableConcept("practiceSetting", element.getPracticeSetting());
29223      }
29224      if (element.hasSourcePatientInfo()) {
29225        composeReference("sourcePatientInfo", element.getSourcePatientInfo());
29226      }
29227      if (element.hasRelated()) {
29228        openArray("related");
29229        for (DocumentReference.DocumentReferenceContextRelatedComponent e : element.getRelated()) 
29230          composeDocumentReferenceDocumentReferenceContextRelatedComponent(null, e);
29231        closeArray();
29232      };
29233  }
29234
29235  protected void composeDocumentReferenceDocumentReferenceContextRelatedComponent(String name, DocumentReference.DocumentReferenceContextRelatedComponent element) throws IOException {
29236    if (element != null) {
29237      open(name);
29238      composeDocumentReferenceDocumentReferenceContextRelatedComponentInner(element);
29239      close();
29240    }
29241  }
29242
29243  protected void composeDocumentReferenceDocumentReferenceContextRelatedComponentInner(DocumentReference.DocumentReferenceContextRelatedComponent element) throws IOException {
29244      composeBackbone(element);
29245      if (element.hasIdentifier()) {
29246        composeIdentifier("identifier", element.getIdentifier());
29247      }
29248      if (element.hasRef()) {
29249        composeReference("ref", element.getRef());
29250      }
29251  }
29252
29253  protected void composeEligibilityRequest(String name, EligibilityRequest element) throws IOException {
29254    if (element != null) {
29255      prop("resourceType", name);
29256      composeEligibilityRequestInner(element);
29257    }
29258  }
29259
29260  protected void composeEligibilityRequestInner(EligibilityRequest element) throws IOException {
29261      composeDomainResourceElements(element);
29262      if (element.hasIdentifier()) {
29263        openArray("identifier");
29264        for (Identifier e : element.getIdentifier()) 
29265          composeIdentifier(null, e);
29266        closeArray();
29267      };
29268      if (element.hasStatusElement()) {
29269        composeEnumerationCore("status", element.getStatusElement(), new EligibilityRequest.EligibilityRequestStatusEnumFactory(), false);
29270        composeEnumerationExtras("status", element.getStatusElement(), new EligibilityRequest.EligibilityRequestStatusEnumFactory(), false);
29271      }
29272      if (element.hasPriority()) {
29273        composeCodeableConcept("priority", element.getPriority());
29274      }
29275      if (element.hasPatient()) {
29276        composeReference("patient", element.getPatient());
29277      }
29278      if (element.hasServiced()) {
29279        composeType("serviced", element.getServiced());
29280      }
29281      if (element.hasCreatedElement()) {
29282        composeDateTimeCore("created", element.getCreatedElement(), false);
29283        composeDateTimeExtras("created", element.getCreatedElement(), false);
29284      }
29285      if (element.hasEnterer()) {
29286        composeReference("enterer", element.getEnterer());
29287      }
29288      if (element.hasProvider()) {
29289        composeReference("provider", element.getProvider());
29290      }
29291      if (element.hasOrganization()) {
29292        composeReference("organization", element.getOrganization());
29293      }
29294      if (element.hasInsurer()) {
29295        composeReference("insurer", element.getInsurer());
29296      }
29297      if (element.hasFacility()) {
29298        composeReference("facility", element.getFacility());
29299      }
29300      if (element.hasCoverage()) {
29301        composeReference("coverage", element.getCoverage());
29302      }
29303      if (element.hasBusinessArrangementElement()) {
29304        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
29305        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
29306      }
29307      if (element.hasBenefitCategory()) {
29308        composeCodeableConcept("benefitCategory", element.getBenefitCategory());
29309      }
29310      if (element.hasBenefitSubCategory()) {
29311        composeCodeableConcept("benefitSubCategory", element.getBenefitSubCategory());
29312      }
29313  }
29314
29315  protected void composeEligibilityResponse(String name, EligibilityResponse element) throws IOException {
29316    if (element != null) {
29317      prop("resourceType", name);
29318      composeEligibilityResponseInner(element);
29319    }
29320  }
29321
29322  protected void composeEligibilityResponseInner(EligibilityResponse element) throws IOException {
29323      composeDomainResourceElements(element);
29324      if (element.hasIdentifier()) {
29325        openArray("identifier");
29326        for (Identifier e : element.getIdentifier()) 
29327          composeIdentifier(null, e);
29328        closeArray();
29329      };
29330      if (element.hasStatusElement()) {
29331        composeEnumerationCore("status", element.getStatusElement(), new EligibilityResponse.EligibilityResponseStatusEnumFactory(), false);
29332        composeEnumerationExtras("status", element.getStatusElement(), new EligibilityResponse.EligibilityResponseStatusEnumFactory(), false);
29333      }
29334      if (element.hasCreatedElement()) {
29335        composeDateTimeCore("created", element.getCreatedElement(), false);
29336        composeDateTimeExtras("created", element.getCreatedElement(), false);
29337      }
29338      if (element.hasRequestProvider()) {
29339        composeReference("requestProvider", element.getRequestProvider());
29340      }
29341      if (element.hasRequestOrganization()) {
29342        composeReference("requestOrganization", element.getRequestOrganization());
29343      }
29344      if (element.hasRequest()) {
29345        composeReference("request", element.getRequest());
29346      }
29347      if (element.hasOutcome()) {
29348        composeCodeableConcept("outcome", element.getOutcome());
29349      }
29350      if (element.hasDispositionElement()) {
29351        composeStringCore("disposition", element.getDispositionElement(), false);
29352        composeStringExtras("disposition", element.getDispositionElement(), false);
29353      }
29354      if (element.hasInsurer()) {
29355        composeReference("insurer", element.getInsurer());
29356      }
29357      if (element.hasInforceElement()) {
29358        composeBooleanCore("inforce", element.getInforceElement(), false);
29359        composeBooleanExtras("inforce", element.getInforceElement(), false);
29360      }
29361      if (element.hasInsurance()) {
29362        openArray("insurance");
29363        for (EligibilityResponse.InsuranceComponent e : element.getInsurance()) 
29364          composeEligibilityResponseInsuranceComponent(null, e);
29365        closeArray();
29366      };
29367      if (element.hasForm()) {
29368        composeCodeableConcept("form", element.getForm());
29369      }
29370      if (element.hasError()) {
29371        openArray("error");
29372        for (EligibilityResponse.ErrorsComponent e : element.getError()) 
29373          composeEligibilityResponseErrorsComponent(null, e);
29374        closeArray();
29375      };
29376  }
29377
29378  protected void composeEligibilityResponseInsuranceComponent(String name, EligibilityResponse.InsuranceComponent element) throws IOException {
29379    if (element != null) {
29380      open(name);
29381      composeEligibilityResponseInsuranceComponentInner(element);
29382      close();
29383    }
29384  }
29385
29386  protected void composeEligibilityResponseInsuranceComponentInner(EligibilityResponse.InsuranceComponent element) throws IOException {
29387      composeBackbone(element);
29388      if (element.hasCoverage()) {
29389        composeReference("coverage", element.getCoverage());
29390      }
29391      if (element.hasContract()) {
29392        composeReference("contract", element.getContract());
29393      }
29394      if (element.hasBenefitBalance()) {
29395        openArray("benefitBalance");
29396        for (EligibilityResponse.BenefitsComponent e : element.getBenefitBalance()) 
29397          composeEligibilityResponseBenefitsComponent(null, e);
29398        closeArray();
29399      };
29400  }
29401
29402  protected void composeEligibilityResponseBenefitsComponent(String name, EligibilityResponse.BenefitsComponent element) throws IOException {
29403    if (element != null) {
29404      open(name);
29405      composeEligibilityResponseBenefitsComponentInner(element);
29406      close();
29407    }
29408  }
29409
29410  protected void composeEligibilityResponseBenefitsComponentInner(EligibilityResponse.BenefitsComponent element) throws IOException {
29411      composeBackbone(element);
29412      if (element.hasCategory()) {
29413        composeCodeableConcept("category", element.getCategory());
29414      }
29415      if (element.hasSubCategory()) {
29416        composeCodeableConcept("subCategory", element.getSubCategory());
29417      }
29418      if (element.hasExcludedElement()) {
29419        composeBooleanCore("excluded", element.getExcludedElement(), false);
29420        composeBooleanExtras("excluded", element.getExcludedElement(), false);
29421      }
29422      if (element.hasNameElement()) {
29423        composeStringCore("name", element.getNameElement(), false);
29424        composeStringExtras("name", element.getNameElement(), false);
29425      }
29426      if (element.hasDescriptionElement()) {
29427        composeStringCore("description", element.getDescriptionElement(), false);
29428        composeStringExtras("description", element.getDescriptionElement(), false);
29429      }
29430      if (element.hasNetwork()) {
29431        composeCodeableConcept("network", element.getNetwork());
29432      }
29433      if (element.hasUnit()) {
29434        composeCodeableConcept("unit", element.getUnit());
29435      }
29436      if (element.hasTerm()) {
29437        composeCodeableConcept("term", element.getTerm());
29438      }
29439      if (element.hasFinancial()) {
29440        openArray("financial");
29441        for (EligibilityResponse.BenefitComponent e : element.getFinancial()) 
29442          composeEligibilityResponseBenefitComponent(null, e);
29443        closeArray();
29444      };
29445  }
29446
29447  protected void composeEligibilityResponseBenefitComponent(String name, EligibilityResponse.BenefitComponent element) throws IOException {
29448    if (element != null) {
29449      open(name);
29450      composeEligibilityResponseBenefitComponentInner(element);
29451      close();
29452    }
29453  }
29454
29455  protected void composeEligibilityResponseBenefitComponentInner(EligibilityResponse.BenefitComponent element) throws IOException {
29456      composeBackbone(element);
29457      if (element.hasType()) {
29458        composeCodeableConcept("type", element.getType());
29459      }
29460      if (element.hasAllowed()) {
29461        composeType("allowed", element.getAllowed());
29462      }
29463      if (element.hasUsed()) {
29464        composeType("used", element.getUsed());
29465      }
29466  }
29467
29468  protected void composeEligibilityResponseErrorsComponent(String name, EligibilityResponse.ErrorsComponent element) throws IOException {
29469    if (element != null) {
29470      open(name);
29471      composeEligibilityResponseErrorsComponentInner(element);
29472      close();
29473    }
29474  }
29475
29476  protected void composeEligibilityResponseErrorsComponentInner(EligibilityResponse.ErrorsComponent element) throws IOException {
29477      composeBackbone(element);
29478      if (element.hasCode()) {
29479        composeCodeableConcept("code", element.getCode());
29480      }
29481  }
29482
29483  protected void composeEncounter(String name, Encounter element) throws IOException {
29484    if (element != null) {
29485      prop("resourceType", name);
29486      composeEncounterInner(element);
29487    }
29488  }
29489
29490  protected void composeEncounterInner(Encounter element) throws IOException {
29491      composeDomainResourceElements(element);
29492      if (element.hasIdentifier()) {
29493        openArray("identifier");
29494        for (Identifier e : element.getIdentifier()) 
29495          composeIdentifier(null, e);
29496        closeArray();
29497      };
29498      if (element.hasStatusElement()) {
29499        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
29500        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
29501      }
29502      if (element.hasStatusHistory()) {
29503        openArray("statusHistory");
29504        for (Encounter.StatusHistoryComponent e : element.getStatusHistory()) 
29505          composeEncounterStatusHistoryComponent(null, e);
29506        closeArray();
29507      };
29508      if (element.hasClass_()) {
29509        composeCoding("class", element.getClass_());
29510      }
29511      if (element.hasClassHistory()) {
29512        openArray("classHistory");
29513        for (Encounter.ClassHistoryComponent e : element.getClassHistory()) 
29514          composeEncounterClassHistoryComponent(null, e);
29515        closeArray();
29516      };
29517      if (element.hasType()) {
29518        openArray("type");
29519        for (CodeableConcept e : element.getType()) 
29520          composeCodeableConcept(null, e);
29521        closeArray();
29522      };
29523      if (element.hasPriority()) {
29524        composeCodeableConcept("priority", element.getPriority());
29525      }
29526      if (element.hasSubject()) {
29527        composeReference("subject", element.getSubject());
29528      }
29529      if (element.hasEpisodeOfCare()) {
29530        openArray("episodeOfCare");
29531        for (Reference e : element.getEpisodeOfCare()) 
29532          composeReference(null, e);
29533        closeArray();
29534      };
29535      if (element.hasIncomingReferral()) {
29536        openArray("incomingReferral");
29537        for (Reference e : element.getIncomingReferral()) 
29538          composeReference(null, e);
29539        closeArray();
29540      };
29541      if (element.hasParticipant()) {
29542        openArray("participant");
29543        for (Encounter.EncounterParticipantComponent e : element.getParticipant()) 
29544          composeEncounterEncounterParticipantComponent(null, e);
29545        closeArray();
29546      };
29547      if (element.hasAppointment()) {
29548        composeReference("appointment", element.getAppointment());
29549      }
29550      if (element.hasPeriod()) {
29551        composePeriod("period", element.getPeriod());
29552      }
29553      if (element.hasLength()) {
29554        composeDuration("length", element.getLength());
29555      }
29556      if (element.hasReason()) {
29557        openArray("reason");
29558        for (CodeableConcept e : element.getReason()) 
29559          composeCodeableConcept(null, e);
29560        closeArray();
29561      };
29562      if (element.hasDiagnosis()) {
29563        openArray("diagnosis");
29564        for (Encounter.DiagnosisComponent e : element.getDiagnosis()) 
29565          composeEncounterDiagnosisComponent(null, e);
29566        closeArray();
29567      };
29568      if (element.hasAccount()) {
29569        openArray("account");
29570        for (Reference e : element.getAccount()) 
29571          composeReference(null, e);
29572        closeArray();
29573      };
29574      if (element.hasHospitalization()) {
29575        composeEncounterEncounterHospitalizationComponent("hospitalization", element.getHospitalization());
29576      }
29577      if (element.hasLocation()) {
29578        openArray("location");
29579        for (Encounter.EncounterLocationComponent e : element.getLocation()) 
29580          composeEncounterEncounterLocationComponent(null, e);
29581        closeArray();
29582      };
29583      if (element.hasServiceProvider()) {
29584        composeReference("serviceProvider", element.getServiceProvider());
29585      }
29586      if (element.hasPartOf()) {
29587        composeReference("partOf", element.getPartOf());
29588      }
29589  }
29590
29591  protected void composeEncounterStatusHistoryComponent(String name, Encounter.StatusHistoryComponent element) throws IOException {
29592    if (element != null) {
29593      open(name);
29594      composeEncounterStatusHistoryComponentInner(element);
29595      close();
29596    }
29597  }
29598
29599  protected void composeEncounterStatusHistoryComponentInner(Encounter.StatusHistoryComponent element) throws IOException {
29600      composeBackbone(element);
29601      if (element.hasStatusElement()) {
29602        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
29603        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
29604      }
29605      if (element.hasPeriod()) {
29606        composePeriod("period", element.getPeriod());
29607      }
29608  }
29609
29610  protected void composeEncounterClassHistoryComponent(String name, Encounter.ClassHistoryComponent element) throws IOException {
29611    if (element != null) {
29612      open(name);
29613      composeEncounterClassHistoryComponentInner(element);
29614      close();
29615    }
29616  }
29617
29618  protected void composeEncounterClassHistoryComponentInner(Encounter.ClassHistoryComponent element) throws IOException {
29619      composeBackbone(element);
29620      if (element.hasClass_()) {
29621        composeCoding("class", element.getClass_());
29622      }
29623      if (element.hasPeriod()) {
29624        composePeriod("period", element.getPeriod());
29625      }
29626  }
29627
29628  protected void composeEncounterEncounterParticipantComponent(String name, Encounter.EncounterParticipantComponent element) throws IOException {
29629    if (element != null) {
29630      open(name);
29631      composeEncounterEncounterParticipantComponentInner(element);
29632      close();
29633    }
29634  }
29635
29636  protected void composeEncounterEncounterParticipantComponentInner(Encounter.EncounterParticipantComponent element) throws IOException {
29637      composeBackbone(element);
29638      if (element.hasType()) {
29639        openArray("type");
29640        for (CodeableConcept e : element.getType()) 
29641          composeCodeableConcept(null, e);
29642        closeArray();
29643      };
29644      if (element.hasPeriod()) {
29645        composePeriod("period", element.getPeriod());
29646      }
29647      if (element.hasIndividual()) {
29648        composeReference("individual", element.getIndividual());
29649      }
29650  }
29651
29652  protected void composeEncounterDiagnosisComponent(String name, Encounter.DiagnosisComponent element) throws IOException {
29653    if (element != null) {
29654      open(name);
29655      composeEncounterDiagnosisComponentInner(element);
29656      close();
29657    }
29658  }
29659
29660  protected void composeEncounterDiagnosisComponentInner(Encounter.DiagnosisComponent element) throws IOException {
29661      composeBackbone(element);
29662      if (element.hasCondition()) {
29663        composeReference("condition", element.getCondition());
29664      }
29665      if (element.hasRole()) {
29666        composeCodeableConcept("role", element.getRole());
29667      }
29668      if (element.hasRankElement()) {
29669        composePositiveIntCore("rank", element.getRankElement(), false);
29670        composePositiveIntExtras("rank", element.getRankElement(), false);
29671      }
29672  }
29673
29674  protected void composeEncounterEncounterHospitalizationComponent(String name, Encounter.EncounterHospitalizationComponent element) throws IOException {
29675    if (element != null) {
29676      open(name);
29677      composeEncounterEncounterHospitalizationComponentInner(element);
29678      close();
29679    }
29680  }
29681
29682  protected void composeEncounterEncounterHospitalizationComponentInner(Encounter.EncounterHospitalizationComponent element) throws IOException {
29683      composeBackbone(element);
29684      if (element.hasPreAdmissionIdentifier()) {
29685        composeIdentifier("preAdmissionIdentifier", element.getPreAdmissionIdentifier());
29686      }
29687      if (element.hasOrigin()) {
29688        composeReference("origin", element.getOrigin());
29689      }
29690      if (element.hasAdmitSource()) {
29691        composeCodeableConcept("admitSource", element.getAdmitSource());
29692      }
29693      if (element.hasReAdmission()) {
29694        composeCodeableConcept("reAdmission", element.getReAdmission());
29695      }
29696      if (element.hasDietPreference()) {
29697        openArray("dietPreference");
29698        for (CodeableConcept e : element.getDietPreference()) 
29699          composeCodeableConcept(null, e);
29700        closeArray();
29701      };
29702      if (element.hasSpecialCourtesy()) {
29703        openArray("specialCourtesy");
29704        for (CodeableConcept e : element.getSpecialCourtesy()) 
29705          composeCodeableConcept(null, e);
29706        closeArray();
29707      };
29708      if (element.hasSpecialArrangement()) {
29709        openArray("specialArrangement");
29710        for (CodeableConcept e : element.getSpecialArrangement()) 
29711          composeCodeableConcept(null, e);
29712        closeArray();
29713      };
29714      if (element.hasDestination()) {
29715        composeReference("destination", element.getDestination());
29716      }
29717      if (element.hasDischargeDisposition()) {
29718        composeCodeableConcept("dischargeDisposition", element.getDischargeDisposition());
29719      }
29720  }
29721
29722  protected void composeEncounterEncounterLocationComponent(String name, Encounter.EncounterLocationComponent element) throws IOException {
29723    if (element != null) {
29724      open(name);
29725      composeEncounterEncounterLocationComponentInner(element);
29726      close();
29727    }
29728  }
29729
29730  protected void composeEncounterEncounterLocationComponentInner(Encounter.EncounterLocationComponent element) throws IOException {
29731      composeBackbone(element);
29732      if (element.hasLocation()) {
29733        composeReference("location", element.getLocation());
29734      }
29735      if (element.hasStatusElement()) {
29736        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory(), false);
29737        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory(), false);
29738      }
29739      if (element.hasPeriod()) {
29740        composePeriod("period", element.getPeriod());
29741      }
29742  }
29743
29744  protected void composeEndpoint(String name, Endpoint element) throws IOException {
29745    if (element != null) {
29746      prop("resourceType", name);
29747      composeEndpointInner(element);
29748    }
29749  }
29750
29751  protected void composeEndpointInner(Endpoint element) throws IOException {
29752      composeDomainResourceElements(element);
29753      if (element.hasIdentifier()) {
29754        openArray("identifier");
29755        for (Identifier e : element.getIdentifier()) 
29756          composeIdentifier(null, e);
29757        closeArray();
29758      };
29759      if (element.hasStatusElement()) {
29760        composeEnumerationCore("status", element.getStatusElement(), new Endpoint.EndpointStatusEnumFactory(), false);
29761        composeEnumerationExtras("status", element.getStatusElement(), new Endpoint.EndpointStatusEnumFactory(), false);
29762      }
29763      if (element.hasConnectionType()) {
29764        composeCoding("connectionType", element.getConnectionType());
29765      }
29766      if (element.hasNameElement()) {
29767        composeStringCore("name", element.getNameElement(), false);
29768        composeStringExtras("name", element.getNameElement(), false);
29769      }
29770      if (element.hasManagingOrganization()) {
29771        composeReference("managingOrganization", element.getManagingOrganization());
29772      }
29773      if (element.hasContact()) {
29774        openArray("contact");
29775        for (ContactPoint e : element.getContact()) 
29776          composeContactPoint(null, e);
29777        closeArray();
29778      };
29779      if (element.hasPeriod()) {
29780        composePeriod("period", element.getPeriod());
29781      }
29782      if (element.hasPayloadType()) {
29783        openArray("payloadType");
29784        for (CodeableConcept e : element.getPayloadType()) 
29785          composeCodeableConcept(null, e);
29786        closeArray();
29787      };
29788      if (element.hasPayloadMimeType()) {
29789        openArray("payloadMimeType");
29790        for (CodeType e : element.getPayloadMimeType()) 
29791          composeCodeCore(null, e, true);
29792        closeArray();
29793        if (anyHasExtras(element.getPayloadMimeType())) {
29794          openArray("_payloadMimeType");
29795          for (CodeType e : element.getPayloadMimeType()) 
29796            composeCodeExtras(null, e, true);
29797          closeArray();
29798        }
29799      };
29800      if (element.hasAddressElement()) {
29801        composeUriCore("address", element.getAddressElement(), false);
29802        composeUriExtras("address", element.getAddressElement(), false);
29803      }
29804      if (element.hasHeader()) {
29805        openArray("header");
29806        for (StringType e : element.getHeader()) 
29807          composeStringCore(null, e, true);
29808        closeArray();
29809        if (anyHasExtras(element.getHeader())) {
29810          openArray("_header");
29811          for (StringType e : element.getHeader()) 
29812            composeStringExtras(null, e, true);
29813          closeArray();
29814        }
29815      };
29816  }
29817
29818  protected void composeEnrollmentRequest(String name, EnrollmentRequest element) throws IOException {
29819    if (element != null) {
29820      prop("resourceType", name);
29821      composeEnrollmentRequestInner(element);
29822    }
29823  }
29824
29825  protected void composeEnrollmentRequestInner(EnrollmentRequest element) throws IOException {
29826      composeDomainResourceElements(element);
29827      if (element.hasIdentifier()) {
29828        openArray("identifier");
29829        for (Identifier e : element.getIdentifier()) 
29830          composeIdentifier(null, e);
29831        closeArray();
29832      };
29833      if (element.hasStatusElement()) {
29834        composeEnumerationCore("status", element.getStatusElement(), new EnrollmentRequest.EnrollmentRequestStatusEnumFactory(), false);
29835        composeEnumerationExtras("status", element.getStatusElement(), new EnrollmentRequest.EnrollmentRequestStatusEnumFactory(), false);
29836      }
29837      if (element.hasCreatedElement()) {
29838        composeDateTimeCore("created", element.getCreatedElement(), false);
29839        composeDateTimeExtras("created", element.getCreatedElement(), false);
29840      }
29841      if (element.hasInsurer()) {
29842        composeReference("insurer", element.getInsurer());
29843      }
29844      if (element.hasProvider()) {
29845        composeReference("provider", element.getProvider());
29846      }
29847      if (element.hasOrganization()) {
29848        composeReference("organization", element.getOrganization());
29849      }
29850      if (element.hasSubject()) {
29851        composeReference("subject", element.getSubject());
29852      }
29853      if (element.hasCoverage()) {
29854        composeReference("coverage", element.getCoverage());
29855      }
29856  }
29857
29858  protected void composeEnrollmentResponse(String name, EnrollmentResponse element) throws IOException {
29859    if (element != null) {
29860      prop("resourceType", name);
29861      composeEnrollmentResponseInner(element);
29862    }
29863  }
29864
29865  protected void composeEnrollmentResponseInner(EnrollmentResponse element) throws IOException {
29866      composeDomainResourceElements(element);
29867      if (element.hasIdentifier()) {
29868        openArray("identifier");
29869        for (Identifier e : element.getIdentifier()) 
29870          composeIdentifier(null, e);
29871        closeArray();
29872      };
29873      if (element.hasStatusElement()) {
29874        composeEnumerationCore("status", element.getStatusElement(), new EnrollmentResponse.EnrollmentResponseStatusEnumFactory(), false);
29875        composeEnumerationExtras("status", element.getStatusElement(), new EnrollmentResponse.EnrollmentResponseStatusEnumFactory(), false);
29876      }
29877      if (element.hasRequest()) {
29878        composeReference("request", element.getRequest());
29879      }
29880      if (element.hasOutcome()) {
29881        composeCodeableConcept("outcome", element.getOutcome());
29882      }
29883      if (element.hasDispositionElement()) {
29884        composeStringCore("disposition", element.getDispositionElement(), false);
29885        composeStringExtras("disposition", element.getDispositionElement(), false);
29886      }
29887      if (element.hasCreatedElement()) {
29888        composeDateTimeCore("created", element.getCreatedElement(), false);
29889        composeDateTimeExtras("created", element.getCreatedElement(), false);
29890      }
29891      if (element.hasOrganization()) {
29892        composeReference("organization", element.getOrganization());
29893      }
29894      if (element.hasRequestProvider()) {
29895        composeReference("requestProvider", element.getRequestProvider());
29896      }
29897      if (element.hasRequestOrganization()) {
29898        composeReference("requestOrganization", element.getRequestOrganization());
29899      }
29900  }
29901
29902  protected void composeEpisodeOfCare(String name, EpisodeOfCare element) throws IOException {
29903    if (element != null) {
29904      prop("resourceType", name);
29905      composeEpisodeOfCareInner(element);
29906    }
29907  }
29908
29909  protected void composeEpisodeOfCareInner(EpisodeOfCare element) throws IOException {
29910      composeDomainResourceElements(element);
29911      if (element.hasIdentifier()) {
29912        openArray("identifier");
29913        for (Identifier e : element.getIdentifier()) 
29914          composeIdentifier(null, e);
29915        closeArray();
29916      };
29917      if (element.hasStatusElement()) {
29918        composeEnumerationCore("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
29919        composeEnumerationExtras("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
29920      }
29921      if (element.hasStatusHistory()) {
29922        openArray("statusHistory");
29923        for (EpisodeOfCare.EpisodeOfCareStatusHistoryComponent e : element.getStatusHistory()) 
29924          composeEpisodeOfCareEpisodeOfCareStatusHistoryComponent(null, e);
29925        closeArray();
29926      };
29927      if (element.hasType()) {
29928        openArray("type");
29929        for (CodeableConcept e : element.getType()) 
29930          composeCodeableConcept(null, e);
29931        closeArray();
29932      };
29933      if (element.hasDiagnosis()) {
29934        openArray("diagnosis");
29935        for (EpisodeOfCare.DiagnosisComponent e : element.getDiagnosis()) 
29936          composeEpisodeOfCareDiagnosisComponent(null, e);
29937        closeArray();
29938      };
29939      if (element.hasPatient()) {
29940        composeReference("patient", element.getPatient());
29941      }
29942      if (element.hasManagingOrganization()) {
29943        composeReference("managingOrganization", element.getManagingOrganization());
29944      }
29945      if (element.hasPeriod()) {
29946        composePeriod("period", element.getPeriod());
29947      }
29948      if (element.hasReferralRequest()) {
29949        openArray("referralRequest");
29950        for (Reference e : element.getReferralRequest()) 
29951          composeReference(null, e);
29952        closeArray();
29953      };
29954      if (element.hasCareManager()) {
29955        composeReference("careManager", element.getCareManager());
29956      }
29957      if (element.hasTeam()) {
29958        openArray("team");
29959        for (Reference e : element.getTeam()) 
29960          composeReference(null, e);
29961        closeArray();
29962      };
29963      if (element.hasAccount()) {
29964        openArray("account");
29965        for (Reference e : element.getAccount()) 
29966          composeReference(null, e);
29967        closeArray();
29968      };
29969  }
29970
29971  protected void composeEpisodeOfCareEpisodeOfCareStatusHistoryComponent(String name, EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
29972    if (element != null) {
29973      open(name);
29974      composeEpisodeOfCareEpisodeOfCareStatusHistoryComponentInner(element);
29975      close();
29976    }
29977  }
29978
29979  protected void composeEpisodeOfCareEpisodeOfCareStatusHistoryComponentInner(EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
29980      composeBackbone(element);
29981      if (element.hasStatusElement()) {
29982        composeEnumerationCore("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
29983        composeEnumerationExtras("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
29984      }
29985      if (element.hasPeriod()) {
29986        composePeriod("period", element.getPeriod());
29987      }
29988  }
29989
29990  protected void composeEpisodeOfCareDiagnosisComponent(String name, EpisodeOfCare.DiagnosisComponent element) throws IOException {
29991    if (element != null) {
29992      open(name);
29993      composeEpisodeOfCareDiagnosisComponentInner(element);
29994      close();
29995    }
29996  }
29997
29998  protected void composeEpisodeOfCareDiagnosisComponentInner(EpisodeOfCare.DiagnosisComponent element) throws IOException {
29999      composeBackbone(element);
30000      if (element.hasCondition()) {
30001        composeReference("condition", element.getCondition());
30002      }
30003      if (element.hasRole()) {
30004        composeCodeableConcept("role", element.getRole());
30005      }
30006      if (element.hasRankElement()) {
30007        composePositiveIntCore("rank", element.getRankElement(), false);
30008        composePositiveIntExtras("rank", element.getRankElement(), false);
30009      }
30010  }
30011
30012  protected void composeExpansionProfile(String name, ExpansionProfile element) throws IOException {
30013    if (element != null) {
30014      prop("resourceType", name);
30015      composeExpansionProfileInner(element);
30016    }
30017  }
30018
30019  protected void composeExpansionProfileInner(ExpansionProfile element) throws IOException {
30020      composeDomainResourceElements(element);
30021      if (element.hasUrlElement()) {
30022        composeUriCore("url", element.getUrlElement(), false);
30023        composeUriExtras("url", element.getUrlElement(), false);
30024      }
30025      if (element.hasIdentifier()) {
30026        composeIdentifier("identifier", element.getIdentifier());
30027      }
30028      if (element.hasVersionElement()) {
30029        composeStringCore("version", element.getVersionElement(), false);
30030        composeStringExtras("version", element.getVersionElement(), false);
30031      }
30032      if (element.hasNameElement()) {
30033        composeStringCore("name", element.getNameElement(), false);
30034        composeStringExtras("name", element.getNameElement(), false);
30035      }
30036      if (element.hasStatusElement()) {
30037        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
30038        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
30039      }
30040      if (element.hasExperimentalElement()) {
30041        composeBooleanCore("experimental", element.getExperimentalElement(), false);
30042        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
30043      }
30044      if (element.hasDateElement()) {
30045        composeDateTimeCore("date", element.getDateElement(), false);
30046        composeDateTimeExtras("date", element.getDateElement(), false);
30047      }
30048      if (element.hasPublisherElement()) {
30049        composeStringCore("publisher", element.getPublisherElement(), false);
30050        composeStringExtras("publisher", element.getPublisherElement(), false);
30051      }
30052      if (element.hasContact()) {
30053        openArray("contact");
30054        for (ContactDetail e : element.getContact()) 
30055          composeContactDetail(null, e);
30056        closeArray();
30057      };
30058      if (element.hasDescriptionElement()) {
30059        composeMarkdownCore("description", element.getDescriptionElement(), false);
30060        composeMarkdownExtras("description", element.getDescriptionElement(), false);
30061      }
30062      if (element.hasUseContext()) {
30063        openArray("useContext");
30064        for (UsageContext e : element.getUseContext()) 
30065          composeUsageContext(null, e);
30066        closeArray();
30067      };
30068      if (element.hasJurisdiction()) {
30069        openArray("jurisdiction");
30070        for (CodeableConcept e : element.getJurisdiction()) 
30071          composeCodeableConcept(null, e);
30072        closeArray();
30073      };
30074      if (element.hasFixedVersion()) {
30075        openArray("fixedVersion");
30076        for (ExpansionProfile.ExpansionProfileFixedVersionComponent e : element.getFixedVersion()) 
30077          composeExpansionProfileExpansionProfileFixedVersionComponent(null, e);
30078        closeArray();
30079      };
30080      if (element.hasExcludedSystem()) {
30081        composeExpansionProfileExpansionProfileExcludedSystemComponent("excludedSystem", element.getExcludedSystem());
30082      }
30083      if (element.hasIncludeDesignationsElement()) {
30084        composeBooleanCore("includeDesignations", element.getIncludeDesignationsElement(), false);
30085        composeBooleanExtras("includeDesignations", element.getIncludeDesignationsElement(), false);
30086      }
30087      if (element.hasDesignation()) {
30088        composeExpansionProfileExpansionProfileDesignationComponent("designation", element.getDesignation());
30089      }
30090      if (element.hasIncludeDefinitionElement()) {
30091        composeBooleanCore("includeDefinition", element.getIncludeDefinitionElement(), false);
30092        composeBooleanExtras("includeDefinition", element.getIncludeDefinitionElement(), false);
30093      }
30094      if (element.hasActiveOnlyElement()) {
30095        composeBooleanCore("activeOnly", element.getActiveOnlyElement(), false);
30096        composeBooleanExtras("activeOnly", element.getActiveOnlyElement(), false);
30097      }
30098      if (element.hasExcludeNestedElement()) {
30099        composeBooleanCore("excludeNested", element.getExcludeNestedElement(), false);
30100        composeBooleanExtras("excludeNested", element.getExcludeNestedElement(), false);
30101      }
30102      if (element.hasExcludeNotForUIElement()) {
30103        composeBooleanCore("excludeNotForUI", element.getExcludeNotForUIElement(), false);
30104        composeBooleanExtras("excludeNotForUI", element.getExcludeNotForUIElement(), false);
30105      }
30106      if (element.hasExcludePostCoordinatedElement()) {
30107        composeBooleanCore("excludePostCoordinated", element.getExcludePostCoordinatedElement(), false);
30108        composeBooleanExtras("excludePostCoordinated", element.getExcludePostCoordinatedElement(), false);
30109      }
30110      if (element.hasDisplayLanguageElement()) {
30111        composeCodeCore("displayLanguage", element.getDisplayLanguageElement(), false);
30112        composeCodeExtras("displayLanguage", element.getDisplayLanguageElement(), false);
30113      }
30114      if (element.hasLimitedExpansionElement()) {
30115        composeBooleanCore("limitedExpansion", element.getLimitedExpansionElement(), false);
30116        composeBooleanExtras("limitedExpansion", element.getLimitedExpansionElement(), false);
30117      }
30118  }
30119
30120  protected void composeExpansionProfileExpansionProfileFixedVersionComponent(String name, ExpansionProfile.ExpansionProfileFixedVersionComponent element) throws IOException {
30121    if (element != null) {
30122      open(name);
30123      composeExpansionProfileExpansionProfileFixedVersionComponentInner(element);
30124      close();
30125    }
30126  }
30127
30128  protected void composeExpansionProfileExpansionProfileFixedVersionComponentInner(ExpansionProfile.ExpansionProfileFixedVersionComponent element) throws IOException {
30129      composeBackbone(element);
30130      if (element.hasSystemElement()) {
30131        composeUriCore("system", element.getSystemElement(), false);
30132        composeUriExtras("system", element.getSystemElement(), false);
30133      }
30134      if (element.hasVersionElement()) {
30135        composeStringCore("version", element.getVersionElement(), false);
30136        composeStringExtras("version", element.getVersionElement(), false);
30137      }
30138      if (element.hasModeElement()) {
30139        composeEnumerationCore("mode", element.getModeElement(), new ExpansionProfile.SystemVersionProcessingModeEnumFactory(), false);
30140        composeEnumerationExtras("mode", element.getModeElement(), new ExpansionProfile.SystemVersionProcessingModeEnumFactory(), false);
30141      }
30142  }
30143
30144  protected void composeExpansionProfileExpansionProfileExcludedSystemComponent(String name, ExpansionProfile.ExpansionProfileExcludedSystemComponent element) throws IOException {
30145    if (element != null) {
30146      open(name);
30147      composeExpansionProfileExpansionProfileExcludedSystemComponentInner(element);
30148      close();
30149    }
30150  }
30151
30152  protected void composeExpansionProfileExpansionProfileExcludedSystemComponentInner(ExpansionProfile.ExpansionProfileExcludedSystemComponent element) throws IOException {
30153      composeBackbone(element);
30154      if (element.hasSystemElement()) {
30155        composeUriCore("system", element.getSystemElement(), false);
30156        composeUriExtras("system", element.getSystemElement(), false);
30157      }
30158      if (element.hasVersionElement()) {
30159        composeStringCore("version", element.getVersionElement(), false);
30160        composeStringExtras("version", element.getVersionElement(), false);
30161      }
30162  }
30163
30164  protected void composeExpansionProfileExpansionProfileDesignationComponent(String name, ExpansionProfile.ExpansionProfileDesignationComponent element) throws IOException {
30165    if (element != null) {
30166      open(name);
30167      composeExpansionProfileExpansionProfileDesignationComponentInner(element);
30168      close();
30169    }
30170  }
30171
30172  protected void composeExpansionProfileExpansionProfileDesignationComponentInner(ExpansionProfile.ExpansionProfileDesignationComponent element) throws IOException {
30173      composeBackbone(element);
30174      if (element.hasInclude()) {
30175        composeExpansionProfileDesignationIncludeComponent("include", element.getInclude());
30176      }
30177      if (element.hasExclude()) {
30178        composeExpansionProfileDesignationExcludeComponent("exclude", element.getExclude());
30179      }
30180  }
30181
30182  protected void composeExpansionProfileDesignationIncludeComponent(String name, ExpansionProfile.DesignationIncludeComponent element) throws IOException {
30183    if (element != null) {
30184      open(name);
30185      composeExpansionProfileDesignationIncludeComponentInner(element);
30186      close();
30187    }
30188  }
30189
30190  protected void composeExpansionProfileDesignationIncludeComponentInner(ExpansionProfile.DesignationIncludeComponent element) throws IOException {
30191      composeBackbone(element);
30192      if (element.hasDesignation()) {
30193        openArray("designation");
30194        for (ExpansionProfile.DesignationIncludeDesignationComponent e : element.getDesignation()) 
30195          composeExpansionProfileDesignationIncludeDesignationComponent(null, e);
30196        closeArray();
30197      };
30198  }
30199
30200  protected void composeExpansionProfileDesignationIncludeDesignationComponent(String name, ExpansionProfile.DesignationIncludeDesignationComponent element) throws IOException {
30201    if (element != null) {
30202      open(name);
30203      composeExpansionProfileDesignationIncludeDesignationComponentInner(element);
30204      close();
30205    }
30206  }
30207
30208  protected void composeExpansionProfileDesignationIncludeDesignationComponentInner(ExpansionProfile.DesignationIncludeDesignationComponent element) throws IOException {
30209      composeBackbone(element);
30210      if (element.hasLanguageElement()) {
30211        composeCodeCore("language", element.getLanguageElement(), false);
30212        composeCodeExtras("language", element.getLanguageElement(), false);
30213      }
30214      if (element.hasUse()) {
30215        composeCoding("use", element.getUse());
30216      }
30217  }
30218
30219  protected void composeExpansionProfileDesignationExcludeComponent(String name, ExpansionProfile.DesignationExcludeComponent element) throws IOException {
30220    if (element != null) {
30221      open(name);
30222      composeExpansionProfileDesignationExcludeComponentInner(element);
30223      close();
30224    }
30225  }
30226
30227  protected void composeExpansionProfileDesignationExcludeComponentInner(ExpansionProfile.DesignationExcludeComponent element) throws IOException {
30228      composeBackbone(element);
30229      if (element.hasDesignation()) {
30230        openArray("designation");
30231        for (ExpansionProfile.DesignationExcludeDesignationComponent e : element.getDesignation()) 
30232          composeExpansionProfileDesignationExcludeDesignationComponent(null, e);
30233        closeArray();
30234      };
30235  }
30236
30237  protected void composeExpansionProfileDesignationExcludeDesignationComponent(String name, ExpansionProfile.DesignationExcludeDesignationComponent element) throws IOException {
30238    if (element != null) {
30239      open(name);
30240      composeExpansionProfileDesignationExcludeDesignationComponentInner(element);
30241      close();
30242    }
30243  }
30244
30245  protected void composeExpansionProfileDesignationExcludeDesignationComponentInner(ExpansionProfile.DesignationExcludeDesignationComponent element) throws IOException {
30246      composeBackbone(element);
30247      if (element.hasLanguageElement()) {
30248        composeCodeCore("language", element.getLanguageElement(), false);
30249        composeCodeExtras("language", element.getLanguageElement(), false);
30250      }
30251      if (element.hasUse()) {
30252        composeCoding("use", element.getUse());
30253      }
30254  }
30255
30256  protected void composeExplanationOfBenefit(String name, ExplanationOfBenefit element) throws IOException {
30257    if (element != null) {
30258      prop("resourceType", name);
30259      composeExplanationOfBenefitInner(element);
30260    }
30261  }
30262
30263  protected void composeExplanationOfBenefitInner(ExplanationOfBenefit element) throws IOException {
30264      composeDomainResourceElements(element);
30265      if (element.hasIdentifier()) {
30266        openArray("identifier");
30267        for (Identifier e : element.getIdentifier()) 
30268          composeIdentifier(null, e);
30269        closeArray();
30270      };
30271      if (element.hasStatusElement()) {
30272        composeEnumerationCore("status", element.getStatusElement(), new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory(), false);
30273        composeEnumerationExtras("status", element.getStatusElement(), new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory(), false);
30274      }
30275      if (element.hasType()) {
30276        composeCodeableConcept("type", element.getType());
30277      }
30278      if (element.hasSubType()) {
30279        openArray("subType");
30280        for (CodeableConcept e : element.getSubType()) 
30281          composeCodeableConcept(null, e);
30282        closeArray();
30283      };
30284      if (element.hasPatient()) {
30285        composeReference("patient", element.getPatient());
30286      }
30287      if (element.hasBillablePeriod()) {
30288        composePeriod("billablePeriod", element.getBillablePeriod());
30289      }
30290      if (element.hasCreatedElement()) {
30291        composeDateTimeCore("created", element.getCreatedElement(), false);
30292        composeDateTimeExtras("created", element.getCreatedElement(), false);
30293      }
30294      if (element.hasEnterer()) {
30295        composeReference("enterer", element.getEnterer());
30296      }
30297      if (element.hasInsurer()) {
30298        composeReference("insurer", element.getInsurer());
30299      }
30300      if (element.hasProvider()) {
30301        composeReference("provider", element.getProvider());
30302      }
30303      if (element.hasOrganization()) {
30304        composeReference("organization", element.getOrganization());
30305      }
30306      if (element.hasReferral()) {
30307        composeReference("referral", element.getReferral());
30308      }
30309      if (element.hasFacility()) {
30310        composeReference("facility", element.getFacility());
30311      }
30312      if (element.hasClaim()) {
30313        composeReference("claim", element.getClaim());
30314      }
30315      if (element.hasClaimResponse()) {
30316        composeReference("claimResponse", element.getClaimResponse());
30317      }
30318      if (element.hasOutcome()) {
30319        composeCodeableConcept("outcome", element.getOutcome());
30320      }
30321      if (element.hasDispositionElement()) {
30322        composeStringCore("disposition", element.getDispositionElement(), false);
30323        composeStringExtras("disposition", element.getDispositionElement(), false);
30324      }
30325      if (element.hasRelated()) {
30326        openArray("related");
30327        for (ExplanationOfBenefit.RelatedClaimComponent e : element.getRelated()) 
30328          composeExplanationOfBenefitRelatedClaimComponent(null, e);
30329        closeArray();
30330      };
30331      if (element.hasPrescription()) {
30332        composeReference("prescription", element.getPrescription());
30333      }
30334      if (element.hasOriginalPrescription()) {
30335        composeReference("originalPrescription", element.getOriginalPrescription());
30336      }
30337      if (element.hasPayee()) {
30338        composeExplanationOfBenefitPayeeComponent("payee", element.getPayee());
30339      }
30340      if (element.hasInformation()) {
30341        openArray("information");
30342        for (ExplanationOfBenefit.SupportingInformationComponent e : element.getInformation()) 
30343          composeExplanationOfBenefitSupportingInformationComponent(null, e);
30344        closeArray();
30345      };
30346      if (element.hasCareTeam()) {
30347        openArray("careTeam");
30348        for (ExplanationOfBenefit.CareTeamComponent e : element.getCareTeam()) 
30349          composeExplanationOfBenefitCareTeamComponent(null, e);
30350        closeArray();
30351      };
30352      if (element.hasDiagnosis()) {
30353        openArray("diagnosis");
30354        for (ExplanationOfBenefit.DiagnosisComponent e : element.getDiagnosis()) 
30355          composeExplanationOfBenefitDiagnosisComponent(null, e);
30356        closeArray();
30357      };
30358      if (element.hasProcedure()) {
30359        openArray("procedure");
30360        for (ExplanationOfBenefit.ProcedureComponent e : element.getProcedure()) 
30361          composeExplanationOfBenefitProcedureComponent(null, e);
30362        closeArray();
30363      };
30364      if (element.hasPrecedenceElement()) {
30365        composePositiveIntCore("precedence", element.getPrecedenceElement(), false);
30366        composePositiveIntExtras("precedence", element.getPrecedenceElement(), false);
30367      }
30368      if (element.hasInsurance()) {
30369        composeExplanationOfBenefitInsuranceComponent("insurance", element.getInsurance());
30370      }
30371      if (element.hasAccident()) {
30372        composeExplanationOfBenefitAccidentComponent("accident", element.getAccident());
30373      }
30374      if (element.hasEmploymentImpacted()) {
30375        composePeriod("employmentImpacted", element.getEmploymentImpacted());
30376      }
30377      if (element.hasHospitalization()) {
30378        composePeriod("hospitalization", element.getHospitalization());
30379      }
30380      if (element.hasItem()) {
30381        openArray("item");
30382        for (ExplanationOfBenefit.ItemComponent e : element.getItem()) 
30383          composeExplanationOfBenefitItemComponent(null, e);
30384        closeArray();
30385      };
30386      if (element.hasAddItem()) {
30387        openArray("addItem");
30388        for (ExplanationOfBenefit.AddedItemComponent e : element.getAddItem()) 
30389          composeExplanationOfBenefitAddedItemComponent(null, e);
30390        closeArray();
30391      };
30392      if (element.hasTotalCost()) {
30393        composeMoney("totalCost", element.getTotalCost());
30394      }
30395      if (element.hasUnallocDeductable()) {
30396        composeMoney("unallocDeductable", element.getUnallocDeductable());
30397      }
30398      if (element.hasTotalBenefit()) {
30399        composeMoney("totalBenefit", element.getTotalBenefit());
30400      }
30401      if (element.hasPayment()) {
30402        composeExplanationOfBenefitPaymentComponent("payment", element.getPayment());
30403      }
30404      if (element.hasForm()) {
30405        composeCodeableConcept("form", element.getForm());
30406      }
30407      if (element.hasProcessNote()) {
30408        openArray("processNote");
30409        for (ExplanationOfBenefit.NoteComponent e : element.getProcessNote()) 
30410          composeExplanationOfBenefitNoteComponent(null, e);
30411        closeArray();
30412      };
30413      if (element.hasBenefitBalance()) {
30414        openArray("benefitBalance");
30415        for (ExplanationOfBenefit.BenefitBalanceComponent e : element.getBenefitBalance()) 
30416          composeExplanationOfBenefitBenefitBalanceComponent(null, e);
30417        closeArray();
30418      };
30419  }
30420
30421  protected void composeExplanationOfBenefitRelatedClaimComponent(String name, ExplanationOfBenefit.RelatedClaimComponent element) throws IOException {
30422    if (element != null) {
30423      open(name);
30424      composeExplanationOfBenefitRelatedClaimComponentInner(element);
30425      close();
30426    }
30427  }
30428
30429  protected void composeExplanationOfBenefitRelatedClaimComponentInner(ExplanationOfBenefit.RelatedClaimComponent element) throws IOException {
30430      composeBackbone(element);
30431      if (element.hasClaim()) {
30432        composeReference("claim", element.getClaim());
30433      }
30434      if (element.hasRelationship()) {
30435        composeCodeableConcept("relationship", element.getRelationship());
30436      }
30437      if (element.hasReference()) {
30438        composeIdentifier("reference", element.getReference());
30439      }
30440  }
30441
30442  protected void composeExplanationOfBenefitPayeeComponent(String name, ExplanationOfBenefit.PayeeComponent element) throws IOException {
30443    if (element != null) {
30444      open(name);
30445      composeExplanationOfBenefitPayeeComponentInner(element);
30446      close();
30447    }
30448  }
30449
30450  protected void composeExplanationOfBenefitPayeeComponentInner(ExplanationOfBenefit.PayeeComponent element) throws IOException {
30451      composeBackbone(element);
30452      if (element.hasType()) {
30453        composeCodeableConcept("type", element.getType());
30454      }
30455      if (element.hasResourceType()) {
30456        composeCodeableConcept("resourceType", element.getResourceType());
30457      }
30458      if (element.hasParty()) {
30459        composeReference("party", element.getParty());
30460      }
30461  }
30462
30463  protected void composeExplanationOfBenefitSupportingInformationComponent(String name, ExplanationOfBenefit.SupportingInformationComponent element) throws IOException {
30464    if (element != null) {
30465      open(name);
30466      composeExplanationOfBenefitSupportingInformationComponentInner(element);
30467      close();
30468    }
30469  }
30470
30471  protected void composeExplanationOfBenefitSupportingInformationComponentInner(ExplanationOfBenefit.SupportingInformationComponent 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.hasCategory()) {
30478        composeCodeableConcept("category", element.getCategory());
30479      }
30480      if (element.hasCode()) {
30481        composeCodeableConcept("code", element.getCode());
30482      }
30483      if (element.hasTiming()) {
30484        composeType("timing", element.getTiming());
30485      }
30486      if (element.hasValue()) {
30487        composeType("value", element.getValue());
30488      }
30489      if (element.hasReason()) {
30490        composeCoding("reason", element.getReason());
30491      }
30492  }
30493
30494  protected void composeExplanationOfBenefitCareTeamComponent(String name, ExplanationOfBenefit.CareTeamComponent element) throws IOException {
30495    if (element != null) {
30496      open(name);
30497      composeExplanationOfBenefitCareTeamComponentInner(element);
30498      close();
30499    }
30500  }
30501
30502  protected void composeExplanationOfBenefitCareTeamComponentInner(ExplanationOfBenefit.CareTeamComponent element) throws IOException {
30503      composeBackbone(element);
30504      if (element.hasSequenceElement()) {
30505        composePositiveIntCore("sequence", element.getSequenceElement(), false);
30506        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
30507      }
30508      if (element.hasProvider()) {
30509        composeReference("provider", element.getProvider());
30510      }
30511      if (element.hasResponsibleElement()) {
30512        composeBooleanCore("responsible", element.getResponsibleElement(), false);
30513        composeBooleanExtras("responsible", element.getResponsibleElement(), false);
30514      }
30515      if (element.hasRole()) {
30516        composeCodeableConcept("role", element.getRole());
30517      }
30518      if (element.hasQualification()) {
30519        composeCodeableConcept("qualification", element.getQualification());
30520      }
30521  }
30522
30523  protected void composeExplanationOfBenefitDiagnosisComponent(String name, ExplanationOfBenefit.DiagnosisComponent element) throws IOException {
30524    if (element != null) {
30525      open(name);
30526      composeExplanationOfBenefitDiagnosisComponentInner(element);
30527      close();
30528    }
30529  }
30530
30531  protected void composeExplanationOfBenefitDiagnosisComponentInner(ExplanationOfBenefit.DiagnosisComponent element) throws IOException {
30532      composeBackbone(element);
30533      if (element.hasSequenceElement()) {
30534        composePositiveIntCore("sequence", element.getSequenceElement(), false);
30535        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
30536      }
30537      if (element.hasDiagnosis()) {
30538        composeType("diagnosis", element.getDiagnosis());
30539      }
30540      if (element.hasType()) {
30541        openArray("type");
30542        for (CodeableConcept e : element.getType()) 
30543          composeCodeableConcept(null, e);
30544        closeArray();
30545      };
30546      if (element.hasPackageCode()) {
30547        composeCodeableConcept("packageCode", element.getPackageCode());
30548      }
30549  }
30550
30551  protected void composeExplanationOfBenefitProcedureComponent(String name, ExplanationOfBenefit.ProcedureComponent element) throws IOException {
30552    if (element != null) {
30553      open(name);
30554      composeExplanationOfBenefitProcedureComponentInner(element);
30555      close();
30556    }
30557  }
30558
30559  protected void composeExplanationOfBenefitProcedureComponentInner(ExplanationOfBenefit.ProcedureComponent element) throws IOException {
30560      composeBackbone(element);
30561      if (element.hasSequenceElement()) {
30562        composePositiveIntCore("sequence", element.getSequenceElement(), false);
30563        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
30564      }
30565      if (element.hasDateElement()) {
30566        composeDateTimeCore("date", element.getDateElement(), false);
30567        composeDateTimeExtras("date", element.getDateElement(), false);
30568      }
30569      if (element.hasProcedure()) {
30570        composeType("procedure", element.getProcedure());
30571      }
30572  }
30573
30574  protected void composeExplanationOfBenefitInsuranceComponent(String name, ExplanationOfBenefit.InsuranceComponent element) throws IOException {
30575    if (element != null) {
30576      open(name);
30577      composeExplanationOfBenefitInsuranceComponentInner(element);
30578      close();
30579    }
30580  }
30581
30582  protected void composeExplanationOfBenefitInsuranceComponentInner(ExplanationOfBenefit.InsuranceComponent element) throws IOException {
30583      composeBackbone(element);
30584      if (element.hasCoverage()) {
30585        composeReference("coverage", element.getCoverage());
30586      }
30587      if (element.hasPreAuthRef()) {
30588        openArray("preAuthRef");
30589        for (StringType e : element.getPreAuthRef()) 
30590          composeStringCore(null, e, true);
30591        closeArray();
30592        if (anyHasExtras(element.getPreAuthRef())) {
30593          openArray("_preAuthRef");
30594          for (StringType e : element.getPreAuthRef()) 
30595            composeStringExtras(null, e, true);
30596          closeArray();
30597        }
30598      };
30599  }
30600
30601  protected void composeExplanationOfBenefitAccidentComponent(String name, ExplanationOfBenefit.AccidentComponent element) throws IOException {
30602    if (element != null) {
30603      open(name);
30604      composeExplanationOfBenefitAccidentComponentInner(element);
30605      close();
30606    }
30607  }
30608
30609  protected void composeExplanationOfBenefitAccidentComponentInner(ExplanationOfBenefit.AccidentComponent element) throws IOException {
30610      composeBackbone(element);
30611      if (element.hasDateElement()) {
30612        composeDateCore("date", element.getDateElement(), false);
30613        composeDateExtras("date", element.getDateElement(), false);
30614      }
30615      if (element.hasType()) {
30616        composeCodeableConcept("type", element.getType());
30617      }
30618      if (element.hasLocation()) {
30619        composeType("location", element.getLocation());
30620      }
30621  }
30622
30623  protected void composeExplanationOfBenefitItemComponent(String name, ExplanationOfBenefit.ItemComponent element) throws IOException {
30624    if (element != null) {
30625      open(name);
30626      composeExplanationOfBenefitItemComponentInner(element);
30627      close();
30628    }
30629  }
30630
30631  protected void composeExplanationOfBenefitItemComponentInner(ExplanationOfBenefit.ItemComponent element) throws IOException {
30632      composeBackbone(element);
30633      if (element.hasSequenceElement()) {
30634        composePositiveIntCore("sequence", element.getSequenceElement(), false);
30635        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
30636      }
30637      if (element.hasCareTeamLinkId()) {
30638        openArray("careTeamLinkId");
30639        for (PositiveIntType e : element.getCareTeamLinkId()) 
30640          composePositiveIntCore(null, e, true);
30641        closeArray();
30642        if (anyHasExtras(element.getCareTeamLinkId())) {
30643          openArray("_careTeamLinkId");
30644          for (PositiveIntType e : element.getCareTeamLinkId()) 
30645            composePositiveIntExtras(null, e, true);
30646          closeArray();
30647        }
30648      };
30649      if (element.hasDiagnosisLinkId()) {
30650        openArray("diagnosisLinkId");
30651        for (PositiveIntType e : element.getDiagnosisLinkId()) 
30652          composePositiveIntCore(null, e, true);
30653        closeArray();
30654        if (anyHasExtras(element.getDiagnosisLinkId())) {
30655          openArray("_diagnosisLinkId");
30656          for (PositiveIntType e : element.getDiagnosisLinkId()) 
30657            composePositiveIntExtras(null, e, true);
30658          closeArray();
30659        }
30660      };
30661      if (element.hasProcedureLinkId()) {
30662        openArray("procedureLinkId");
30663        for (PositiveIntType e : element.getProcedureLinkId()) 
30664          composePositiveIntCore(null, e, true);
30665        closeArray();
30666        if (anyHasExtras(element.getProcedureLinkId())) {
30667          openArray("_procedureLinkId");
30668          for (PositiveIntType e : element.getProcedureLinkId()) 
30669            composePositiveIntExtras(null, e, true);
30670          closeArray();
30671        }
30672      };
30673      if (element.hasInformationLinkId()) {
30674        openArray("informationLinkId");
30675        for (PositiveIntType e : element.getInformationLinkId()) 
30676          composePositiveIntCore(null, e, true);
30677        closeArray();
30678        if (anyHasExtras(element.getInformationLinkId())) {
30679          openArray("_informationLinkId");
30680          for (PositiveIntType e : element.getInformationLinkId()) 
30681            composePositiveIntExtras(null, e, true);
30682          closeArray();
30683        }
30684      };
30685      if (element.hasRevenue()) {
30686        composeCodeableConcept("revenue", element.getRevenue());
30687      }
30688      if (element.hasCategory()) {
30689        composeCodeableConcept("category", element.getCategory());
30690      }
30691      if (element.hasService()) {
30692        composeCodeableConcept("service", element.getService());
30693      }
30694      if (element.hasModifier()) {
30695        openArray("modifier");
30696        for (CodeableConcept e : element.getModifier()) 
30697          composeCodeableConcept(null, e);
30698        closeArray();
30699      };
30700      if (element.hasProgramCode()) {
30701        openArray("programCode");
30702        for (CodeableConcept e : element.getProgramCode()) 
30703          composeCodeableConcept(null, e);
30704        closeArray();
30705      };
30706      if (element.hasServiced()) {
30707        composeType("serviced", element.getServiced());
30708      }
30709      if (element.hasLocation()) {
30710        composeType("location", element.getLocation());
30711      }
30712      if (element.hasQuantity()) {
30713        composeSimpleQuantity("quantity", element.getQuantity());
30714      }
30715      if (element.hasUnitPrice()) {
30716        composeMoney("unitPrice", element.getUnitPrice());
30717      }
30718      if (element.hasFactorElement()) {
30719        composeDecimalCore("factor", element.getFactorElement(), false);
30720        composeDecimalExtras("factor", element.getFactorElement(), false);
30721      }
30722      if (element.hasNet()) {
30723        composeMoney("net", element.getNet());
30724      }
30725      if (element.hasUdi()) {
30726        openArray("udi");
30727        for (Reference e : element.getUdi()) 
30728          composeReference(null, e);
30729        closeArray();
30730      };
30731      if (element.hasBodySite()) {
30732        composeCodeableConcept("bodySite", element.getBodySite());
30733      }
30734      if (element.hasSubSite()) {
30735        openArray("subSite");
30736        for (CodeableConcept e : element.getSubSite()) 
30737          composeCodeableConcept(null, e);
30738        closeArray();
30739      };
30740      if (element.hasEncounter()) {
30741        openArray("encounter");
30742        for (Reference e : element.getEncounter()) 
30743          composeReference(null, e);
30744        closeArray();
30745      };
30746      if (element.hasNoteNumber()) {
30747        openArray("noteNumber");
30748        for (PositiveIntType e : element.getNoteNumber()) 
30749          composePositiveIntCore(null, e, true);
30750        closeArray();
30751        if (anyHasExtras(element.getNoteNumber())) {
30752          openArray("_noteNumber");
30753          for (PositiveIntType e : element.getNoteNumber()) 
30754            composePositiveIntExtras(null, e, true);
30755          closeArray();
30756        }
30757      };
30758      if (element.hasAdjudication()) {
30759        openArray("adjudication");
30760        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
30761          composeExplanationOfBenefitAdjudicationComponent(null, e);
30762        closeArray();
30763      };
30764      if (element.hasDetail()) {
30765        openArray("detail");
30766        for (ExplanationOfBenefit.DetailComponent e : element.getDetail()) 
30767          composeExplanationOfBenefitDetailComponent(null, e);
30768        closeArray();
30769      };
30770  }
30771
30772  protected void composeExplanationOfBenefitAdjudicationComponent(String name, ExplanationOfBenefit.AdjudicationComponent element) throws IOException {
30773    if (element != null) {
30774      open(name);
30775      composeExplanationOfBenefitAdjudicationComponentInner(element);
30776      close();
30777    }
30778  }
30779
30780  protected void composeExplanationOfBenefitAdjudicationComponentInner(ExplanationOfBenefit.AdjudicationComponent element) throws IOException {
30781      composeBackbone(element);
30782      if (element.hasCategory()) {
30783        composeCodeableConcept("category", element.getCategory());
30784      }
30785      if (element.hasReason()) {
30786        composeCodeableConcept("reason", element.getReason());
30787      }
30788      if (element.hasAmount()) {
30789        composeMoney("amount", element.getAmount());
30790      }
30791      if (element.hasValueElement()) {
30792        composeDecimalCore("value", element.getValueElement(), false);
30793        composeDecimalExtras("value", element.getValueElement(), false);
30794      }
30795  }
30796
30797  protected void composeExplanationOfBenefitDetailComponent(String name, ExplanationOfBenefit.DetailComponent element) throws IOException {
30798    if (element != null) {
30799      open(name);
30800      composeExplanationOfBenefitDetailComponentInner(element);
30801      close();
30802    }
30803  }
30804
30805  protected void composeExplanationOfBenefitDetailComponentInner(ExplanationOfBenefit.DetailComponent element) throws IOException {
30806      composeBackbone(element);
30807      if (element.hasSequenceElement()) {
30808        composePositiveIntCore("sequence", element.getSequenceElement(), false);
30809        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
30810      }
30811      if (element.hasType()) {
30812        composeCodeableConcept("type", element.getType());
30813      }
30814      if (element.hasRevenue()) {
30815        composeCodeableConcept("revenue", element.getRevenue());
30816      }
30817      if (element.hasCategory()) {
30818        composeCodeableConcept("category", element.getCategory());
30819      }
30820      if (element.hasService()) {
30821        composeCodeableConcept("service", element.getService());
30822      }
30823      if (element.hasModifier()) {
30824        openArray("modifier");
30825        for (CodeableConcept e : element.getModifier()) 
30826          composeCodeableConcept(null, e);
30827        closeArray();
30828      };
30829      if (element.hasProgramCode()) {
30830        openArray("programCode");
30831        for (CodeableConcept e : element.getProgramCode()) 
30832          composeCodeableConcept(null, e);
30833        closeArray();
30834      };
30835      if (element.hasQuantity()) {
30836        composeSimpleQuantity("quantity", element.getQuantity());
30837      }
30838      if (element.hasUnitPrice()) {
30839        composeMoney("unitPrice", element.getUnitPrice());
30840      }
30841      if (element.hasFactorElement()) {
30842        composeDecimalCore("factor", element.getFactorElement(), false);
30843        composeDecimalExtras("factor", element.getFactorElement(), false);
30844      }
30845      if (element.hasNet()) {
30846        composeMoney("net", element.getNet());
30847      }
30848      if (element.hasUdi()) {
30849        openArray("udi");
30850        for (Reference e : element.getUdi()) 
30851          composeReference(null, e);
30852        closeArray();
30853      };
30854      if (element.hasNoteNumber()) {
30855        openArray("noteNumber");
30856        for (PositiveIntType e : element.getNoteNumber()) 
30857          composePositiveIntCore(null, e, true);
30858        closeArray();
30859        if (anyHasExtras(element.getNoteNumber())) {
30860          openArray("_noteNumber");
30861          for (PositiveIntType e : element.getNoteNumber()) 
30862            composePositiveIntExtras(null, e, true);
30863          closeArray();
30864        }
30865      };
30866      if (element.hasAdjudication()) {
30867        openArray("adjudication");
30868        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
30869          composeExplanationOfBenefitAdjudicationComponent(null, e);
30870        closeArray();
30871      };
30872      if (element.hasSubDetail()) {
30873        openArray("subDetail");
30874        for (ExplanationOfBenefit.SubDetailComponent e : element.getSubDetail()) 
30875          composeExplanationOfBenefitSubDetailComponent(null, e);
30876        closeArray();
30877      };
30878  }
30879
30880  protected void composeExplanationOfBenefitSubDetailComponent(String name, ExplanationOfBenefit.SubDetailComponent element) throws IOException {
30881    if (element != null) {
30882      open(name);
30883      composeExplanationOfBenefitSubDetailComponentInner(element);
30884      close();
30885    }
30886  }
30887
30888  protected void composeExplanationOfBenefitSubDetailComponentInner(ExplanationOfBenefit.SubDetailComponent element) throws IOException {
30889      composeBackbone(element);
30890      if (element.hasSequenceElement()) {
30891        composePositiveIntCore("sequence", element.getSequenceElement(), false);
30892        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
30893      }
30894      if (element.hasType()) {
30895        composeCodeableConcept("type", element.getType());
30896      }
30897      if (element.hasRevenue()) {
30898        composeCodeableConcept("revenue", element.getRevenue());
30899      }
30900      if (element.hasCategory()) {
30901        composeCodeableConcept("category", element.getCategory());
30902      }
30903      if (element.hasService()) {
30904        composeCodeableConcept("service", element.getService());
30905      }
30906      if (element.hasModifier()) {
30907        openArray("modifier");
30908        for (CodeableConcept e : element.getModifier()) 
30909          composeCodeableConcept(null, e);
30910        closeArray();
30911      };
30912      if (element.hasProgramCode()) {
30913        openArray("programCode");
30914        for (CodeableConcept e : element.getProgramCode()) 
30915          composeCodeableConcept(null, e);
30916        closeArray();
30917      };
30918      if (element.hasQuantity()) {
30919        composeSimpleQuantity("quantity", element.getQuantity());
30920      }
30921      if (element.hasUnitPrice()) {
30922        composeMoney("unitPrice", element.getUnitPrice());
30923      }
30924      if (element.hasFactorElement()) {
30925        composeDecimalCore("factor", element.getFactorElement(), false);
30926        composeDecimalExtras("factor", element.getFactorElement(), false);
30927      }
30928      if (element.hasNet()) {
30929        composeMoney("net", element.getNet());
30930      }
30931      if (element.hasUdi()) {
30932        openArray("udi");
30933        for (Reference e : element.getUdi()) 
30934          composeReference(null, e);
30935        closeArray();
30936      };
30937      if (element.hasNoteNumber()) {
30938        openArray("noteNumber");
30939        for (PositiveIntType e : element.getNoteNumber()) 
30940          composePositiveIntCore(null, e, true);
30941        closeArray();
30942        if (anyHasExtras(element.getNoteNumber())) {
30943          openArray("_noteNumber");
30944          for (PositiveIntType e : element.getNoteNumber()) 
30945            composePositiveIntExtras(null, e, true);
30946          closeArray();
30947        }
30948      };
30949      if (element.hasAdjudication()) {
30950        openArray("adjudication");
30951        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
30952          composeExplanationOfBenefitAdjudicationComponent(null, e);
30953        closeArray();
30954      };
30955  }
30956
30957  protected void composeExplanationOfBenefitAddedItemComponent(String name, ExplanationOfBenefit.AddedItemComponent element) throws IOException {
30958    if (element != null) {
30959      open(name);
30960      composeExplanationOfBenefitAddedItemComponentInner(element);
30961      close();
30962    }
30963  }
30964
30965  protected void composeExplanationOfBenefitAddedItemComponentInner(ExplanationOfBenefit.AddedItemComponent element) throws IOException {
30966      composeBackbone(element);
30967      if (element.hasSequenceLinkId()) {
30968        openArray("sequenceLinkId");
30969        for (PositiveIntType e : element.getSequenceLinkId()) 
30970          composePositiveIntCore(null, e, true);
30971        closeArray();
30972        if (anyHasExtras(element.getSequenceLinkId())) {
30973          openArray("_sequenceLinkId");
30974          for (PositiveIntType e : element.getSequenceLinkId()) 
30975            composePositiveIntExtras(null, e, true);
30976          closeArray();
30977        }
30978      };
30979      if (element.hasRevenue()) {
30980        composeCodeableConcept("revenue", element.getRevenue());
30981      }
30982      if (element.hasCategory()) {
30983        composeCodeableConcept("category", element.getCategory());
30984      }
30985      if (element.hasService()) {
30986        composeCodeableConcept("service", element.getService());
30987      }
30988      if (element.hasModifier()) {
30989        openArray("modifier");
30990        for (CodeableConcept e : element.getModifier()) 
30991          composeCodeableConcept(null, e);
30992        closeArray();
30993      };
30994      if (element.hasFee()) {
30995        composeMoney("fee", element.getFee());
30996      }
30997      if (element.hasNoteNumber()) {
30998        openArray("noteNumber");
30999        for (PositiveIntType e : element.getNoteNumber()) 
31000          composePositiveIntCore(null, e, true);
31001        closeArray();
31002        if (anyHasExtras(element.getNoteNumber())) {
31003          openArray("_noteNumber");
31004          for (PositiveIntType e : element.getNoteNumber()) 
31005            composePositiveIntExtras(null, e, true);
31006          closeArray();
31007        }
31008      };
31009      if (element.hasAdjudication()) {
31010        openArray("adjudication");
31011        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
31012          composeExplanationOfBenefitAdjudicationComponent(null, e);
31013        closeArray();
31014      };
31015      if (element.hasDetail()) {
31016        openArray("detail");
31017        for (ExplanationOfBenefit.AddedItemsDetailComponent e : element.getDetail()) 
31018          composeExplanationOfBenefitAddedItemsDetailComponent(null, e);
31019        closeArray();
31020      };
31021  }
31022
31023  protected void composeExplanationOfBenefitAddedItemsDetailComponent(String name, ExplanationOfBenefit.AddedItemsDetailComponent element) throws IOException {
31024    if (element != null) {
31025      open(name);
31026      composeExplanationOfBenefitAddedItemsDetailComponentInner(element);
31027      close();
31028    }
31029  }
31030
31031  protected void composeExplanationOfBenefitAddedItemsDetailComponentInner(ExplanationOfBenefit.AddedItemsDetailComponent element) throws IOException {
31032      composeBackbone(element);
31033      if (element.hasRevenue()) {
31034        composeCodeableConcept("revenue", element.getRevenue());
31035      }
31036      if (element.hasCategory()) {
31037        composeCodeableConcept("category", element.getCategory());
31038      }
31039      if (element.hasService()) {
31040        composeCodeableConcept("service", element.getService());
31041      }
31042      if (element.hasModifier()) {
31043        openArray("modifier");
31044        for (CodeableConcept e : element.getModifier()) 
31045          composeCodeableConcept(null, e);
31046        closeArray();
31047      };
31048      if (element.hasFee()) {
31049        composeMoney("fee", element.getFee());
31050      }
31051      if (element.hasNoteNumber()) {
31052        openArray("noteNumber");
31053        for (PositiveIntType e : element.getNoteNumber()) 
31054          composePositiveIntCore(null, e, true);
31055        closeArray();
31056        if (anyHasExtras(element.getNoteNumber())) {
31057          openArray("_noteNumber");
31058          for (PositiveIntType e : element.getNoteNumber()) 
31059            composePositiveIntExtras(null, e, true);
31060          closeArray();
31061        }
31062      };
31063      if (element.hasAdjudication()) {
31064        openArray("adjudication");
31065        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
31066          composeExplanationOfBenefitAdjudicationComponent(null, e);
31067        closeArray();
31068      };
31069  }
31070
31071  protected void composeExplanationOfBenefitPaymentComponent(String name, ExplanationOfBenefit.PaymentComponent element) throws IOException {
31072    if (element != null) {
31073      open(name);
31074      composeExplanationOfBenefitPaymentComponentInner(element);
31075      close();
31076    }
31077  }
31078
31079  protected void composeExplanationOfBenefitPaymentComponentInner(ExplanationOfBenefit.PaymentComponent element) throws IOException {
31080      composeBackbone(element);
31081      if (element.hasType()) {
31082        composeCodeableConcept("type", element.getType());
31083      }
31084      if (element.hasAdjustment()) {
31085        composeMoney("adjustment", element.getAdjustment());
31086      }
31087      if (element.hasAdjustmentReason()) {
31088        composeCodeableConcept("adjustmentReason", element.getAdjustmentReason());
31089      }
31090      if (element.hasDateElement()) {
31091        composeDateCore("date", element.getDateElement(), false);
31092        composeDateExtras("date", element.getDateElement(), false);
31093      }
31094      if (element.hasAmount()) {
31095        composeMoney("amount", element.getAmount());
31096      }
31097      if (element.hasIdentifier()) {
31098        composeIdentifier("identifier", element.getIdentifier());
31099      }
31100  }
31101
31102  protected void composeExplanationOfBenefitNoteComponent(String name, ExplanationOfBenefit.NoteComponent element) throws IOException {
31103    if (element != null) {
31104      open(name);
31105      composeExplanationOfBenefitNoteComponentInner(element);
31106      close();
31107    }
31108  }
31109
31110  protected void composeExplanationOfBenefitNoteComponentInner(ExplanationOfBenefit.NoteComponent element) throws IOException {
31111      composeBackbone(element);
31112      if (element.hasNumberElement()) {
31113        composePositiveIntCore("number", element.getNumberElement(), false);
31114        composePositiveIntExtras("number", element.getNumberElement(), false);
31115      }
31116      if (element.hasType()) {
31117        composeCodeableConcept("type", element.getType());
31118      }
31119      if (element.hasTextElement()) {
31120        composeStringCore("text", element.getTextElement(), false);
31121        composeStringExtras("text", element.getTextElement(), false);
31122      }
31123      if (element.hasLanguage()) {
31124        composeCodeableConcept("language", element.getLanguage());
31125      }
31126  }
31127
31128  protected void composeExplanationOfBenefitBenefitBalanceComponent(String name, ExplanationOfBenefit.BenefitBalanceComponent element) throws IOException {
31129    if (element != null) {
31130      open(name);
31131      composeExplanationOfBenefitBenefitBalanceComponentInner(element);
31132      close();
31133    }
31134  }
31135
31136  protected void composeExplanationOfBenefitBenefitBalanceComponentInner(ExplanationOfBenefit.BenefitBalanceComponent element) throws IOException {
31137      composeBackbone(element);
31138      if (element.hasCategory()) {
31139        composeCodeableConcept("category", element.getCategory());
31140      }
31141      if (element.hasSubCategory()) {
31142        composeCodeableConcept("subCategory", element.getSubCategory());
31143      }
31144      if (element.hasExcludedElement()) {
31145        composeBooleanCore("excluded", element.getExcludedElement(), false);
31146        composeBooleanExtras("excluded", element.getExcludedElement(), false);
31147      }
31148      if (element.hasNameElement()) {
31149        composeStringCore("name", element.getNameElement(), false);
31150        composeStringExtras("name", element.getNameElement(), false);
31151      }
31152      if (element.hasDescriptionElement()) {
31153        composeStringCore("description", element.getDescriptionElement(), false);
31154        composeStringExtras("description", element.getDescriptionElement(), false);
31155      }
31156      if (element.hasNetwork()) {
31157        composeCodeableConcept("network", element.getNetwork());
31158      }
31159      if (element.hasUnit()) {
31160        composeCodeableConcept("unit", element.getUnit());
31161      }
31162      if (element.hasTerm()) {
31163        composeCodeableConcept("term", element.getTerm());
31164      }
31165      if (element.hasFinancial()) {
31166        openArray("financial");
31167        for (ExplanationOfBenefit.BenefitComponent e : element.getFinancial()) 
31168          composeExplanationOfBenefitBenefitComponent(null, e);
31169        closeArray();
31170      };
31171  }
31172
31173  protected void composeExplanationOfBenefitBenefitComponent(String name, ExplanationOfBenefit.BenefitComponent element) throws IOException {
31174    if (element != null) {
31175      open(name);
31176      composeExplanationOfBenefitBenefitComponentInner(element);
31177      close();
31178    }
31179  }
31180
31181  protected void composeExplanationOfBenefitBenefitComponentInner(ExplanationOfBenefit.BenefitComponent element) throws IOException {
31182      composeBackbone(element);
31183      if (element.hasType()) {
31184        composeCodeableConcept("type", element.getType());
31185      }
31186      if (element.hasAllowed()) {
31187        composeType("allowed", element.getAllowed());
31188      }
31189      if (element.hasUsed()) {
31190        composeType("used", element.getUsed());
31191      }
31192  }
31193
31194  protected void composeFamilyMemberHistory(String name, FamilyMemberHistory element) throws IOException {
31195    if (element != null) {
31196      prop("resourceType", name);
31197      composeFamilyMemberHistoryInner(element);
31198    }
31199  }
31200
31201  protected void composeFamilyMemberHistoryInner(FamilyMemberHistory element) throws IOException {
31202      composeDomainResourceElements(element);
31203      if (element.hasIdentifier()) {
31204        openArray("identifier");
31205        for (Identifier e : element.getIdentifier()) 
31206          composeIdentifier(null, e);
31207        closeArray();
31208      };
31209      if (element.hasDefinition()) {
31210        openArray("definition");
31211        for (Reference e : element.getDefinition()) 
31212          composeReference(null, e);
31213        closeArray();
31214      };
31215      if (element.hasStatusElement()) {
31216        composeEnumerationCore("status", element.getStatusElement(), new FamilyMemberHistory.FamilyHistoryStatusEnumFactory(), false);
31217        composeEnumerationExtras("status", element.getStatusElement(), new FamilyMemberHistory.FamilyHistoryStatusEnumFactory(), false);
31218      }
31219      if (element.hasNotDoneElement()) {
31220        composeBooleanCore("notDone", element.getNotDoneElement(), false);
31221        composeBooleanExtras("notDone", element.getNotDoneElement(), false);
31222      }
31223      if (element.hasNotDoneReason()) {
31224        composeCodeableConcept("notDoneReason", element.getNotDoneReason());
31225      }
31226      if (element.hasPatient()) {
31227        composeReference("patient", element.getPatient());
31228      }
31229      if (element.hasDateElement()) {
31230        composeDateTimeCore("date", element.getDateElement(), false);
31231        composeDateTimeExtras("date", element.getDateElement(), false);
31232      }
31233      if (element.hasNameElement()) {
31234        composeStringCore("name", element.getNameElement(), false);
31235        composeStringExtras("name", element.getNameElement(), false);
31236      }
31237      if (element.hasRelationship()) {
31238        composeCodeableConcept("relationship", element.getRelationship());
31239      }
31240      if (element.hasGenderElement()) {
31241        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
31242        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
31243      }
31244      if (element.hasBorn()) {
31245        composeType("born", element.getBorn());
31246      }
31247      if (element.hasAge()) {
31248        composeType("age", element.getAge());
31249      }
31250      if (element.hasEstimatedAgeElement()) {
31251        composeBooleanCore("estimatedAge", element.getEstimatedAgeElement(), false);
31252        composeBooleanExtras("estimatedAge", element.getEstimatedAgeElement(), false);
31253      }
31254      if (element.hasDeceased()) {
31255        composeType("deceased", element.getDeceased());
31256      }
31257      if (element.hasReasonCode()) {
31258        openArray("reasonCode");
31259        for (CodeableConcept e : element.getReasonCode()) 
31260          composeCodeableConcept(null, e);
31261        closeArray();
31262      };
31263      if (element.hasReasonReference()) {
31264        openArray("reasonReference");
31265        for (Reference e : element.getReasonReference()) 
31266          composeReference(null, e);
31267        closeArray();
31268      };
31269      if (element.hasNote()) {
31270        openArray("note");
31271        for (Annotation e : element.getNote()) 
31272          composeAnnotation(null, e);
31273        closeArray();
31274      };
31275      if (element.hasCondition()) {
31276        openArray("condition");
31277        for (FamilyMemberHistory.FamilyMemberHistoryConditionComponent e : element.getCondition()) 
31278          composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent(null, e);
31279        closeArray();
31280      };
31281  }
31282
31283  protected void composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent(String name, FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
31284    if (element != null) {
31285      open(name);
31286      composeFamilyMemberHistoryFamilyMemberHistoryConditionComponentInner(element);
31287      close();
31288    }
31289  }
31290
31291  protected void composeFamilyMemberHistoryFamilyMemberHistoryConditionComponentInner(FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
31292      composeBackbone(element);
31293      if (element.hasCode()) {
31294        composeCodeableConcept("code", element.getCode());
31295      }
31296      if (element.hasOutcome()) {
31297        composeCodeableConcept("outcome", element.getOutcome());
31298      }
31299      if (element.hasOnset()) {
31300        composeType("onset", element.getOnset());
31301      }
31302      if (element.hasNote()) {
31303        openArray("note");
31304        for (Annotation e : element.getNote()) 
31305          composeAnnotation(null, e);
31306        closeArray();
31307      };
31308  }
31309
31310  protected void composeFlag(String name, Flag element) throws IOException {
31311    if (element != null) {
31312      prop("resourceType", name);
31313      composeFlagInner(element);
31314    }
31315  }
31316
31317  protected void composeFlagInner(Flag element) throws IOException {
31318      composeDomainResourceElements(element);
31319      if (element.hasIdentifier()) {
31320        openArray("identifier");
31321        for (Identifier e : element.getIdentifier()) 
31322          composeIdentifier(null, e);
31323        closeArray();
31324      };
31325      if (element.hasStatusElement()) {
31326        composeEnumerationCore("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory(), false);
31327        composeEnumerationExtras("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory(), false);
31328      }
31329      if (element.hasCategory()) {
31330        composeCodeableConcept("category", element.getCategory());
31331      }
31332      if (element.hasCode()) {
31333        composeCodeableConcept("code", element.getCode());
31334      }
31335      if (element.hasSubject()) {
31336        composeReference("subject", element.getSubject());
31337      }
31338      if (element.hasPeriod()) {
31339        composePeriod("period", element.getPeriod());
31340      }
31341      if (element.hasEncounter()) {
31342        composeReference("encounter", element.getEncounter());
31343      }
31344      if (element.hasAuthor()) {
31345        composeReference("author", element.getAuthor());
31346      }
31347  }
31348
31349  protected void composeGoal(String name, Goal element) throws IOException {
31350    if (element != null) {
31351      prop("resourceType", name);
31352      composeGoalInner(element);
31353    }
31354  }
31355
31356  protected void composeGoalInner(Goal element) throws IOException {
31357      composeDomainResourceElements(element);
31358      if (element.hasIdentifier()) {
31359        openArray("identifier");
31360        for (Identifier e : element.getIdentifier()) 
31361          composeIdentifier(null, e);
31362        closeArray();
31363      };
31364      if (element.hasStatusElement()) {
31365        composeEnumerationCore("status", element.getStatusElement(), new Goal.GoalStatusEnumFactory(), false);
31366        composeEnumerationExtras("status", element.getStatusElement(), new Goal.GoalStatusEnumFactory(), false);
31367      }
31368      if (element.hasCategory()) {
31369        openArray("category");
31370        for (CodeableConcept e : element.getCategory()) 
31371          composeCodeableConcept(null, e);
31372        closeArray();
31373      };
31374      if (element.hasPriority()) {
31375        composeCodeableConcept("priority", element.getPriority());
31376      }
31377      if (element.hasDescription()) {
31378        composeCodeableConcept("description", element.getDescription());
31379      }
31380      if (element.hasSubject()) {
31381        composeReference("subject", element.getSubject());
31382      }
31383      if (element.hasStart()) {
31384        composeType("start", element.getStart());
31385      }
31386      if (element.hasTarget()) {
31387        composeGoalGoalTargetComponent("target", element.getTarget());
31388      }
31389      if (element.hasStatusDateElement()) {
31390        composeDateCore("statusDate", element.getStatusDateElement(), false);
31391        composeDateExtras("statusDate", element.getStatusDateElement(), false);
31392      }
31393      if (element.hasStatusReasonElement()) {
31394        composeStringCore("statusReason", element.getStatusReasonElement(), false);
31395        composeStringExtras("statusReason", element.getStatusReasonElement(), false);
31396      }
31397      if (element.hasExpressedBy()) {
31398        composeReference("expressedBy", element.getExpressedBy());
31399      }
31400      if (element.hasAddresses()) {
31401        openArray("addresses");
31402        for (Reference e : element.getAddresses()) 
31403          composeReference(null, e);
31404        closeArray();
31405      };
31406      if (element.hasNote()) {
31407        openArray("note");
31408        for (Annotation e : element.getNote()) 
31409          composeAnnotation(null, e);
31410        closeArray();
31411      };
31412      if (element.hasOutcomeCode()) {
31413        openArray("outcomeCode");
31414        for (CodeableConcept e : element.getOutcomeCode()) 
31415          composeCodeableConcept(null, e);
31416        closeArray();
31417      };
31418      if (element.hasOutcomeReference()) {
31419        openArray("outcomeReference");
31420        for (Reference e : element.getOutcomeReference()) 
31421          composeReference(null, e);
31422        closeArray();
31423      };
31424  }
31425
31426  protected void composeGoalGoalTargetComponent(String name, Goal.GoalTargetComponent element) throws IOException {
31427    if (element != null) {
31428      open(name);
31429      composeGoalGoalTargetComponentInner(element);
31430      close();
31431    }
31432  }
31433
31434  protected void composeGoalGoalTargetComponentInner(Goal.GoalTargetComponent element) throws IOException {
31435      composeBackbone(element);
31436      if (element.hasMeasure()) {
31437        composeCodeableConcept("measure", element.getMeasure());
31438      }
31439      if (element.hasDetail()) {
31440        composeType("detail", element.getDetail());
31441      }
31442      if (element.hasDue()) {
31443        composeType("due", element.getDue());
31444      }
31445  }
31446
31447  protected void composeGraphDefinition(String name, GraphDefinition element) throws IOException {
31448    if (element != null) {
31449      prop("resourceType", name);
31450      composeGraphDefinitionInner(element);
31451    }
31452  }
31453
31454  protected void composeGraphDefinitionInner(GraphDefinition element) throws IOException {
31455      composeDomainResourceElements(element);
31456      if (element.hasUrlElement()) {
31457        composeUriCore("url", element.getUrlElement(), false);
31458        composeUriExtras("url", element.getUrlElement(), false);
31459      }
31460      if (element.hasVersionElement()) {
31461        composeStringCore("version", element.getVersionElement(), false);
31462        composeStringExtras("version", element.getVersionElement(), false);
31463      }
31464      if (element.hasNameElement()) {
31465        composeStringCore("name", element.getNameElement(), false);
31466        composeStringExtras("name", element.getNameElement(), false);
31467      }
31468      if (element.hasStatusElement()) {
31469        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
31470        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
31471      }
31472      if (element.hasExperimentalElement()) {
31473        composeBooleanCore("experimental", element.getExperimentalElement(), false);
31474        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
31475      }
31476      if (element.hasDateElement()) {
31477        composeDateTimeCore("date", element.getDateElement(), false);
31478        composeDateTimeExtras("date", element.getDateElement(), false);
31479      }
31480      if (element.hasPublisherElement()) {
31481        composeStringCore("publisher", element.getPublisherElement(), false);
31482        composeStringExtras("publisher", element.getPublisherElement(), false);
31483      }
31484      if (element.hasContact()) {
31485        openArray("contact");
31486        for (ContactDetail e : element.getContact()) 
31487          composeContactDetail(null, e);
31488        closeArray();
31489      };
31490      if (element.hasDescriptionElement()) {
31491        composeMarkdownCore("description", element.getDescriptionElement(), false);
31492        composeMarkdownExtras("description", element.getDescriptionElement(), false);
31493      }
31494      if (element.hasUseContext()) {
31495        openArray("useContext");
31496        for (UsageContext e : element.getUseContext()) 
31497          composeUsageContext(null, e);
31498        closeArray();
31499      };
31500      if (element.hasJurisdiction()) {
31501        openArray("jurisdiction");
31502        for (CodeableConcept e : element.getJurisdiction()) 
31503          composeCodeableConcept(null, e);
31504        closeArray();
31505      };
31506      if (element.hasPurposeElement()) {
31507        composeMarkdownCore("purpose", element.getPurposeElement(), false);
31508        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
31509      }
31510      if (element.hasStartElement()) {
31511        composeCodeCore("start", element.getStartElement(), false);
31512        composeCodeExtras("start", element.getStartElement(), false);
31513      }
31514      if (element.hasProfileElement()) {
31515        composeUriCore("profile", element.getProfileElement(), false);
31516        composeUriExtras("profile", element.getProfileElement(), false);
31517      }
31518      if (element.hasLink()) {
31519        openArray("link");
31520        for (GraphDefinition.GraphDefinitionLinkComponent e : element.getLink()) 
31521          composeGraphDefinitionGraphDefinitionLinkComponent(null, e);
31522        closeArray();
31523      };
31524  }
31525
31526  protected void composeGraphDefinitionGraphDefinitionLinkComponent(String name, GraphDefinition.GraphDefinitionLinkComponent element) throws IOException {
31527    if (element != null) {
31528      open(name);
31529      composeGraphDefinitionGraphDefinitionLinkComponentInner(element);
31530      close();
31531    }
31532  }
31533
31534  protected void composeGraphDefinitionGraphDefinitionLinkComponentInner(GraphDefinition.GraphDefinitionLinkComponent element) throws IOException {
31535      composeBackbone(element);
31536      if (element.hasPathElement()) {
31537        composeStringCore("path", element.getPathElement(), false);
31538        composeStringExtras("path", element.getPathElement(), false);
31539      }
31540      if (element.hasSliceNameElement()) {
31541        composeStringCore("sliceName", element.getSliceNameElement(), false);
31542        composeStringExtras("sliceName", element.getSliceNameElement(), false);
31543      }
31544      if (element.hasMinElement()) {
31545        composeIntegerCore("min", element.getMinElement(), false);
31546        composeIntegerExtras("min", element.getMinElement(), false);
31547      }
31548      if (element.hasMaxElement()) {
31549        composeStringCore("max", element.getMaxElement(), false);
31550        composeStringExtras("max", element.getMaxElement(), false);
31551      }
31552      if (element.hasDescriptionElement()) {
31553        composeStringCore("description", element.getDescriptionElement(), false);
31554        composeStringExtras("description", element.getDescriptionElement(), false);
31555      }
31556      if (element.hasTarget()) {
31557        openArray("target");
31558        for (GraphDefinition.GraphDefinitionLinkTargetComponent e : element.getTarget()) 
31559          composeGraphDefinitionGraphDefinitionLinkTargetComponent(null, e);
31560        closeArray();
31561      };
31562  }
31563
31564  protected void composeGraphDefinitionGraphDefinitionLinkTargetComponent(String name, GraphDefinition.GraphDefinitionLinkTargetComponent element) throws IOException {
31565    if (element != null) {
31566      open(name);
31567      composeGraphDefinitionGraphDefinitionLinkTargetComponentInner(element);
31568      close();
31569    }
31570  }
31571
31572  protected void composeGraphDefinitionGraphDefinitionLinkTargetComponentInner(GraphDefinition.GraphDefinitionLinkTargetComponent element) throws IOException {
31573      composeBackbone(element);
31574      if (element.hasTypeElement()) {
31575        composeCodeCore("type", element.getTypeElement(), false);
31576        composeCodeExtras("type", element.getTypeElement(), false);
31577      }
31578      if (element.hasProfileElement()) {
31579        composeUriCore("profile", element.getProfileElement(), false);
31580        composeUriExtras("profile", element.getProfileElement(), false);
31581      }
31582      if (element.hasCompartment()) {
31583        openArray("compartment");
31584        for (GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent e : element.getCompartment()) 
31585          composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(null, e);
31586        closeArray();
31587      };
31588      if (element.hasLink()) {
31589        openArray("link");
31590        for (GraphDefinition.GraphDefinitionLinkComponent e : element.getLink()) 
31591          composeGraphDefinitionGraphDefinitionLinkComponent(null, e);
31592        closeArray();
31593      };
31594  }
31595
31596  protected void composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(String name, GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent element) throws IOException {
31597    if (element != null) {
31598      open(name);
31599      composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentInner(element);
31600      close();
31601    }
31602  }
31603
31604  protected void composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentInner(GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent element) throws IOException {
31605      composeBackbone(element);
31606      if (element.hasCodeElement()) {
31607        composeEnumerationCore("code", element.getCodeElement(), new GraphDefinition.CompartmentCodeEnumFactory(), false);
31608        composeEnumerationExtras("code", element.getCodeElement(), new GraphDefinition.CompartmentCodeEnumFactory(), false);
31609      }
31610      if (element.hasRuleElement()) {
31611        composeEnumerationCore("rule", element.getRuleElement(), new GraphDefinition.GraphCompartmentRuleEnumFactory(), false);
31612        composeEnumerationExtras("rule", element.getRuleElement(), new GraphDefinition.GraphCompartmentRuleEnumFactory(), false);
31613      }
31614      if (element.hasExpressionElement()) {
31615        composeStringCore("expression", element.getExpressionElement(), false);
31616        composeStringExtras("expression", element.getExpressionElement(), false);
31617      }
31618      if (element.hasDescriptionElement()) {
31619        composeStringCore("description", element.getDescriptionElement(), false);
31620        composeStringExtras("description", element.getDescriptionElement(), false);
31621      }
31622  }
31623
31624  protected void composeGroup(String name, Group element) throws IOException {
31625    if (element != null) {
31626      prop("resourceType", name);
31627      composeGroupInner(element);
31628    }
31629  }
31630
31631  protected void composeGroupInner(Group element) throws IOException {
31632      composeDomainResourceElements(element);
31633      if (element.hasIdentifier()) {
31634        openArray("identifier");
31635        for (Identifier e : element.getIdentifier()) 
31636          composeIdentifier(null, e);
31637        closeArray();
31638      };
31639      if (element.hasActiveElement()) {
31640        composeBooleanCore("active", element.getActiveElement(), false);
31641        composeBooleanExtras("active", element.getActiveElement(), false);
31642      }
31643      if (element.hasTypeElement()) {
31644        composeEnumerationCore("type", element.getTypeElement(), new Group.GroupTypeEnumFactory(), false);
31645        composeEnumerationExtras("type", element.getTypeElement(), new Group.GroupTypeEnumFactory(), false);
31646      }
31647      if (element.hasActualElement()) {
31648        composeBooleanCore("actual", element.getActualElement(), false);
31649        composeBooleanExtras("actual", element.getActualElement(), false);
31650      }
31651      if (element.hasCode()) {
31652        composeCodeableConcept("code", element.getCode());
31653      }
31654      if (element.hasNameElement()) {
31655        composeStringCore("name", element.getNameElement(), false);
31656        composeStringExtras("name", element.getNameElement(), false);
31657      }
31658      if (element.hasQuantityElement()) {
31659        composeUnsignedIntCore("quantity", element.getQuantityElement(), false);
31660        composeUnsignedIntExtras("quantity", element.getQuantityElement(), false);
31661      }
31662      if (element.hasCharacteristic()) {
31663        openArray("characteristic");
31664        for (Group.GroupCharacteristicComponent e : element.getCharacteristic()) 
31665          composeGroupGroupCharacteristicComponent(null, e);
31666        closeArray();
31667      };
31668      if (element.hasMember()) {
31669        openArray("member");
31670        for (Group.GroupMemberComponent e : element.getMember()) 
31671          composeGroupGroupMemberComponent(null, e);
31672        closeArray();
31673      };
31674  }
31675
31676  protected void composeGroupGroupCharacteristicComponent(String name, Group.GroupCharacteristicComponent element) throws IOException {
31677    if (element != null) {
31678      open(name);
31679      composeGroupGroupCharacteristicComponentInner(element);
31680      close();
31681    }
31682  }
31683
31684  protected void composeGroupGroupCharacteristicComponentInner(Group.GroupCharacteristicComponent element) throws IOException {
31685      composeBackbone(element);
31686      if (element.hasCode()) {
31687        composeCodeableConcept("code", element.getCode());
31688      }
31689      if (element.hasValue()) {
31690        composeType("value", element.getValue());
31691      }
31692      if (element.hasExcludeElement()) {
31693        composeBooleanCore("exclude", element.getExcludeElement(), false);
31694        composeBooleanExtras("exclude", element.getExcludeElement(), false);
31695      }
31696      if (element.hasPeriod()) {
31697        composePeriod("period", element.getPeriod());
31698      }
31699  }
31700
31701  protected void composeGroupGroupMemberComponent(String name, Group.GroupMemberComponent element) throws IOException {
31702    if (element != null) {
31703      open(name);
31704      composeGroupGroupMemberComponentInner(element);
31705      close();
31706    }
31707  }
31708
31709  protected void composeGroupGroupMemberComponentInner(Group.GroupMemberComponent element) throws IOException {
31710      composeBackbone(element);
31711      if (element.hasEntity()) {
31712        composeReference("entity", element.getEntity());
31713      }
31714      if (element.hasPeriod()) {
31715        composePeriod("period", element.getPeriod());
31716      }
31717      if (element.hasInactiveElement()) {
31718        composeBooleanCore("inactive", element.getInactiveElement(), false);
31719        composeBooleanExtras("inactive", element.getInactiveElement(), false);
31720      }
31721  }
31722
31723  protected void composeGuidanceResponse(String name, GuidanceResponse element) throws IOException {
31724    if (element != null) {
31725      prop("resourceType", name);
31726      composeGuidanceResponseInner(element);
31727    }
31728  }
31729
31730  protected void composeGuidanceResponseInner(GuidanceResponse element) throws IOException {
31731      composeDomainResourceElements(element);
31732      if (element.hasRequestIdElement()) {
31733        composeIdCore("requestId", element.getRequestIdElement(), false);
31734        composeIdExtras("requestId", element.getRequestIdElement(), false);
31735      }
31736      if (element.hasIdentifier()) {
31737        composeIdentifier("identifier", element.getIdentifier());
31738      }
31739      if (element.hasModule()) {
31740        composeReference("module", element.getModule());
31741      }
31742      if (element.hasStatusElement()) {
31743        composeEnumerationCore("status", element.getStatusElement(), new GuidanceResponse.GuidanceResponseStatusEnumFactory(), false);
31744        composeEnumerationExtras("status", element.getStatusElement(), new GuidanceResponse.GuidanceResponseStatusEnumFactory(), false);
31745      }
31746      if (element.hasSubject()) {
31747        composeReference("subject", element.getSubject());
31748      }
31749      if (element.hasContext()) {
31750        composeReference("context", element.getContext());
31751      }
31752      if (element.hasOccurrenceDateTimeElement()) {
31753        composeDateTimeCore("occurrenceDateTime", element.getOccurrenceDateTimeElement(), false);
31754        composeDateTimeExtras("occurrenceDateTime", element.getOccurrenceDateTimeElement(), false);
31755      }
31756      if (element.hasPerformer()) {
31757        composeReference("performer", element.getPerformer());
31758      }
31759      if (element.hasReason()) {
31760        composeType("reason", element.getReason());
31761      }
31762      if (element.hasNote()) {
31763        openArray("note");
31764        for (Annotation e : element.getNote()) 
31765          composeAnnotation(null, e);
31766        closeArray();
31767      };
31768      if (element.hasEvaluationMessage()) {
31769        openArray("evaluationMessage");
31770        for (Reference e : element.getEvaluationMessage()) 
31771          composeReference(null, e);
31772        closeArray();
31773      };
31774      if (element.hasOutputParameters()) {
31775        composeReference("outputParameters", element.getOutputParameters());
31776      }
31777      if (element.hasResult()) {
31778        composeReference("result", element.getResult());
31779      }
31780      if (element.hasDataRequirement()) {
31781        openArray("dataRequirement");
31782        for (DataRequirement e : element.getDataRequirement()) 
31783          composeDataRequirement(null, e);
31784        closeArray();
31785      };
31786  }
31787
31788  protected void composeHealthcareService(String name, HealthcareService element) throws IOException {
31789    if (element != null) {
31790      prop("resourceType", name);
31791      composeHealthcareServiceInner(element);
31792    }
31793  }
31794
31795  protected void composeHealthcareServiceInner(HealthcareService element) throws IOException {
31796      composeDomainResourceElements(element);
31797      if (element.hasIdentifier()) {
31798        openArray("identifier");
31799        for (Identifier e : element.getIdentifier()) 
31800          composeIdentifier(null, e);
31801        closeArray();
31802      };
31803      if (element.hasActiveElement()) {
31804        composeBooleanCore("active", element.getActiveElement(), false);
31805        composeBooleanExtras("active", element.getActiveElement(), false);
31806      }
31807      if (element.hasProvidedBy()) {
31808        composeReference("providedBy", element.getProvidedBy());
31809      }
31810      if (element.hasCategory()) {
31811        composeCodeableConcept("category", element.getCategory());
31812      }
31813      if (element.hasType()) {
31814        openArray("type");
31815        for (CodeableConcept e : element.getType()) 
31816          composeCodeableConcept(null, e);
31817        closeArray();
31818      };
31819      if (element.hasSpecialty()) {
31820        openArray("specialty");
31821        for (CodeableConcept e : element.getSpecialty()) 
31822          composeCodeableConcept(null, e);
31823        closeArray();
31824      };
31825      if (element.hasLocation()) {
31826        openArray("location");
31827        for (Reference e : element.getLocation()) 
31828          composeReference(null, e);
31829        closeArray();
31830      };
31831      if (element.hasNameElement()) {
31832        composeStringCore("name", element.getNameElement(), false);
31833        composeStringExtras("name", element.getNameElement(), false);
31834      }
31835      if (element.hasCommentElement()) {
31836        composeStringCore("comment", element.getCommentElement(), false);
31837        composeStringExtras("comment", element.getCommentElement(), false);
31838      }
31839      if (element.hasExtraDetailsElement()) {
31840        composeStringCore("extraDetails", element.getExtraDetailsElement(), false);
31841        composeStringExtras("extraDetails", element.getExtraDetailsElement(), false);
31842      }
31843      if (element.hasPhoto()) {
31844        composeAttachment("photo", element.getPhoto());
31845      }
31846      if (element.hasTelecom()) {
31847        openArray("telecom");
31848        for (ContactPoint e : element.getTelecom()) 
31849          composeContactPoint(null, e);
31850        closeArray();
31851      };
31852      if (element.hasCoverageArea()) {
31853        openArray("coverageArea");
31854        for (Reference e : element.getCoverageArea()) 
31855          composeReference(null, e);
31856        closeArray();
31857      };
31858      if (element.hasServiceProvisionCode()) {
31859        openArray("serviceProvisionCode");
31860        for (CodeableConcept e : element.getServiceProvisionCode()) 
31861          composeCodeableConcept(null, e);
31862        closeArray();
31863      };
31864      if (element.hasEligibility()) {
31865        composeCodeableConcept("eligibility", element.getEligibility());
31866      }
31867      if (element.hasEligibilityNoteElement()) {
31868        composeStringCore("eligibilityNote", element.getEligibilityNoteElement(), false);
31869        composeStringExtras("eligibilityNote", element.getEligibilityNoteElement(), false);
31870      }
31871      if (element.hasProgramName()) {
31872        openArray("programName");
31873        for (StringType e : element.getProgramName()) 
31874          composeStringCore(null, e, true);
31875        closeArray();
31876        if (anyHasExtras(element.getProgramName())) {
31877          openArray("_programName");
31878          for (StringType e : element.getProgramName()) 
31879            composeStringExtras(null, e, true);
31880          closeArray();
31881        }
31882      };
31883      if (element.hasCharacteristic()) {
31884        openArray("characteristic");
31885        for (CodeableConcept e : element.getCharacteristic()) 
31886          composeCodeableConcept(null, e);
31887        closeArray();
31888      };
31889      if (element.hasReferralMethod()) {
31890        openArray("referralMethod");
31891        for (CodeableConcept e : element.getReferralMethod()) 
31892          composeCodeableConcept(null, e);
31893        closeArray();
31894      };
31895      if (element.hasAppointmentRequiredElement()) {
31896        composeBooleanCore("appointmentRequired", element.getAppointmentRequiredElement(), false);
31897        composeBooleanExtras("appointmentRequired", element.getAppointmentRequiredElement(), false);
31898      }
31899      if (element.hasAvailableTime()) {
31900        openArray("availableTime");
31901        for (HealthcareService.HealthcareServiceAvailableTimeComponent e : element.getAvailableTime()) 
31902          composeHealthcareServiceHealthcareServiceAvailableTimeComponent(null, e);
31903        closeArray();
31904      };
31905      if (element.hasNotAvailable()) {
31906        openArray("notAvailable");
31907        for (HealthcareService.HealthcareServiceNotAvailableComponent e : element.getNotAvailable()) 
31908          composeHealthcareServiceHealthcareServiceNotAvailableComponent(null, e);
31909        closeArray();
31910      };
31911      if (element.hasAvailabilityExceptionsElement()) {
31912        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
31913        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
31914      }
31915      if (element.hasEndpoint()) {
31916        openArray("endpoint");
31917        for (Reference e : element.getEndpoint()) 
31918          composeReference(null, e);
31919        closeArray();
31920      };
31921  }
31922
31923  protected void composeHealthcareServiceHealthcareServiceAvailableTimeComponent(String name, HealthcareService.HealthcareServiceAvailableTimeComponent element) throws IOException {
31924    if (element != null) {
31925      open(name);
31926      composeHealthcareServiceHealthcareServiceAvailableTimeComponentInner(element);
31927      close();
31928    }
31929  }
31930
31931  protected void composeHealthcareServiceHealthcareServiceAvailableTimeComponentInner(HealthcareService.HealthcareServiceAvailableTimeComponent element) throws IOException {
31932      composeBackbone(element);
31933      if (element.hasDaysOfWeek()) {
31934        openArray("daysOfWeek");
31935        for (Enumeration<HealthcareService.DaysOfWeek> e : element.getDaysOfWeek()) 
31936          composeEnumerationCore(null, e, new HealthcareService.DaysOfWeekEnumFactory(), true);
31937        closeArray();
31938        if (anyHasExtras(element.getDaysOfWeek())) {
31939          openArray("_daysOfWeek");
31940          for (Enumeration<HealthcareService.DaysOfWeek> e : element.getDaysOfWeek()) 
31941            composeEnumerationExtras(null, e, new HealthcareService.DaysOfWeekEnumFactory(), true);
31942          closeArray();
31943        }
31944      };
31945      if (element.hasAllDayElement()) {
31946        composeBooleanCore("allDay", element.getAllDayElement(), false);
31947        composeBooleanExtras("allDay", element.getAllDayElement(), false);
31948      }
31949      if (element.hasAvailableStartTimeElement()) {
31950        composeTimeCore("availableStartTime", element.getAvailableStartTimeElement(), false);
31951        composeTimeExtras("availableStartTime", element.getAvailableStartTimeElement(), false);
31952      }
31953      if (element.hasAvailableEndTimeElement()) {
31954        composeTimeCore("availableEndTime", element.getAvailableEndTimeElement(), false);
31955        composeTimeExtras("availableEndTime", element.getAvailableEndTimeElement(), false);
31956      }
31957  }
31958
31959  protected void composeHealthcareServiceHealthcareServiceNotAvailableComponent(String name, HealthcareService.HealthcareServiceNotAvailableComponent element) throws IOException {
31960    if (element != null) {
31961      open(name);
31962      composeHealthcareServiceHealthcareServiceNotAvailableComponentInner(element);
31963      close();
31964    }
31965  }
31966
31967  protected void composeHealthcareServiceHealthcareServiceNotAvailableComponentInner(HealthcareService.HealthcareServiceNotAvailableComponent element) throws IOException {
31968      composeBackbone(element);
31969      if (element.hasDescriptionElement()) {
31970        composeStringCore("description", element.getDescriptionElement(), false);
31971        composeStringExtras("description", element.getDescriptionElement(), false);
31972      }
31973      if (element.hasDuring()) {
31974        composePeriod("during", element.getDuring());
31975      }
31976  }
31977
31978  protected void composeImagingManifest(String name, ImagingManifest element) throws IOException {
31979    if (element != null) {
31980      prop("resourceType", name);
31981      composeImagingManifestInner(element);
31982    }
31983  }
31984
31985  protected void composeImagingManifestInner(ImagingManifest element) throws IOException {
31986      composeDomainResourceElements(element);
31987      if (element.hasIdentifier()) {
31988        composeIdentifier("identifier", element.getIdentifier());
31989      }
31990      if (element.hasPatient()) {
31991        composeReference("patient", element.getPatient());
31992      }
31993      if (element.hasAuthoringTimeElement()) {
31994        composeDateTimeCore("authoringTime", element.getAuthoringTimeElement(), false);
31995        composeDateTimeExtras("authoringTime", element.getAuthoringTimeElement(), false);
31996      }
31997      if (element.hasAuthor()) {
31998        composeReference("author", element.getAuthor());
31999      }
32000      if (element.hasDescriptionElement()) {
32001        composeStringCore("description", element.getDescriptionElement(), false);
32002        composeStringExtras("description", element.getDescriptionElement(), false);
32003      }
32004      if (element.hasStudy()) {
32005        openArray("study");
32006        for (ImagingManifest.StudyComponent e : element.getStudy()) 
32007          composeImagingManifestStudyComponent(null, e);
32008        closeArray();
32009      };
32010  }
32011
32012  protected void composeImagingManifestStudyComponent(String name, ImagingManifest.StudyComponent element) throws IOException {
32013    if (element != null) {
32014      open(name);
32015      composeImagingManifestStudyComponentInner(element);
32016      close();
32017    }
32018  }
32019
32020  protected void composeImagingManifestStudyComponentInner(ImagingManifest.StudyComponent element) throws IOException {
32021      composeBackbone(element);
32022      if (element.hasUidElement()) {
32023        composeOidCore("uid", element.getUidElement(), false);
32024        composeOidExtras("uid", element.getUidElement(), false);
32025      }
32026      if (element.hasImagingStudy()) {
32027        composeReference("imagingStudy", element.getImagingStudy());
32028      }
32029      if (element.hasEndpoint()) {
32030        openArray("endpoint");
32031        for (Reference e : element.getEndpoint()) 
32032          composeReference(null, e);
32033        closeArray();
32034      };
32035      if (element.hasSeries()) {
32036        openArray("series");
32037        for (ImagingManifest.SeriesComponent e : element.getSeries()) 
32038          composeImagingManifestSeriesComponent(null, e);
32039        closeArray();
32040      };
32041  }
32042
32043  protected void composeImagingManifestSeriesComponent(String name, ImagingManifest.SeriesComponent element) throws IOException {
32044    if (element != null) {
32045      open(name);
32046      composeImagingManifestSeriesComponentInner(element);
32047      close();
32048    }
32049  }
32050
32051  protected void composeImagingManifestSeriesComponentInner(ImagingManifest.SeriesComponent element) throws IOException {
32052      composeBackbone(element);
32053      if (element.hasUidElement()) {
32054        composeOidCore("uid", element.getUidElement(), false);
32055        composeOidExtras("uid", element.getUidElement(), false);
32056      }
32057      if (element.hasEndpoint()) {
32058        openArray("endpoint");
32059        for (Reference e : element.getEndpoint()) 
32060          composeReference(null, e);
32061        closeArray();
32062      };
32063      if (element.hasInstance()) {
32064        openArray("instance");
32065        for (ImagingManifest.InstanceComponent e : element.getInstance()) 
32066          composeImagingManifestInstanceComponent(null, e);
32067        closeArray();
32068      };
32069  }
32070
32071  protected void composeImagingManifestInstanceComponent(String name, ImagingManifest.InstanceComponent element) throws IOException {
32072    if (element != null) {
32073      open(name);
32074      composeImagingManifestInstanceComponentInner(element);
32075      close();
32076    }
32077  }
32078
32079  protected void composeImagingManifestInstanceComponentInner(ImagingManifest.InstanceComponent element) throws IOException {
32080      composeBackbone(element);
32081      if (element.hasSopClassElement()) {
32082        composeOidCore("sopClass", element.getSopClassElement(), false);
32083        composeOidExtras("sopClass", element.getSopClassElement(), false);
32084      }
32085      if (element.hasUidElement()) {
32086        composeOidCore("uid", element.getUidElement(), false);
32087        composeOidExtras("uid", element.getUidElement(), false);
32088      }
32089  }
32090
32091  protected void composeImagingStudy(String name, ImagingStudy element) throws IOException {
32092    if (element != null) {
32093      prop("resourceType", name);
32094      composeImagingStudyInner(element);
32095    }
32096  }
32097
32098  protected void composeImagingStudyInner(ImagingStudy element) throws IOException {
32099      composeDomainResourceElements(element);
32100      if (element.hasUidElement()) {
32101        composeOidCore("uid", element.getUidElement(), false);
32102        composeOidExtras("uid", element.getUidElement(), false);
32103      }
32104      if (element.hasAccession()) {
32105        composeIdentifier("accession", element.getAccession());
32106      }
32107      if (element.hasIdentifier()) {
32108        openArray("identifier");
32109        for (Identifier e : element.getIdentifier()) 
32110          composeIdentifier(null, e);
32111        closeArray();
32112      };
32113      if (element.hasAvailabilityElement()) {
32114        composeEnumerationCore("availability", element.getAvailabilityElement(), new ImagingStudy.InstanceAvailabilityEnumFactory(), false);
32115        composeEnumerationExtras("availability", element.getAvailabilityElement(), new ImagingStudy.InstanceAvailabilityEnumFactory(), false);
32116      }
32117      if (element.hasModalityList()) {
32118        openArray("modalityList");
32119        for (Coding e : element.getModalityList()) 
32120          composeCoding(null, e);
32121        closeArray();
32122      };
32123      if (element.hasPatient()) {
32124        composeReference("patient", element.getPatient());
32125      }
32126      if (element.hasContext()) {
32127        composeReference("context", element.getContext());
32128      }
32129      if (element.hasStartedElement()) {
32130        composeDateTimeCore("started", element.getStartedElement(), false);
32131        composeDateTimeExtras("started", element.getStartedElement(), false);
32132      }
32133      if (element.hasBasedOn()) {
32134        openArray("basedOn");
32135        for (Reference e : element.getBasedOn()) 
32136          composeReference(null, e);
32137        closeArray();
32138      };
32139      if (element.hasReferrer()) {
32140        composeReference("referrer", element.getReferrer());
32141      }
32142      if (element.hasInterpreter()) {
32143        openArray("interpreter");
32144        for (Reference e : element.getInterpreter()) 
32145          composeReference(null, e);
32146        closeArray();
32147      };
32148      if (element.hasEndpoint()) {
32149        openArray("endpoint");
32150        for (Reference e : element.getEndpoint()) 
32151          composeReference(null, e);
32152        closeArray();
32153      };
32154      if (element.hasNumberOfSeriesElement()) {
32155        composeUnsignedIntCore("numberOfSeries", element.getNumberOfSeriesElement(), false);
32156        composeUnsignedIntExtras("numberOfSeries", element.getNumberOfSeriesElement(), false);
32157      }
32158      if (element.hasNumberOfInstancesElement()) {
32159        composeUnsignedIntCore("numberOfInstances", element.getNumberOfInstancesElement(), false);
32160        composeUnsignedIntExtras("numberOfInstances", element.getNumberOfInstancesElement(), false);
32161      }
32162      if (element.hasProcedureReference()) {
32163        openArray("procedureReference");
32164        for (Reference e : element.getProcedureReference()) 
32165          composeReference(null, e);
32166        closeArray();
32167      };
32168      if (element.hasProcedureCode()) {
32169        openArray("procedureCode");
32170        for (CodeableConcept e : element.getProcedureCode()) 
32171          composeCodeableConcept(null, e);
32172        closeArray();
32173      };
32174      if (element.hasReason()) {
32175        composeCodeableConcept("reason", element.getReason());
32176      }
32177      if (element.hasDescriptionElement()) {
32178        composeStringCore("description", element.getDescriptionElement(), false);
32179        composeStringExtras("description", element.getDescriptionElement(), false);
32180      }
32181      if (element.hasSeries()) {
32182        openArray("series");
32183        for (ImagingStudy.ImagingStudySeriesComponent e : element.getSeries()) 
32184          composeImagingStudyImagingStudySeriesComponent(null, e);
32185        closeArray();
32186      };
32187  }
32188
32189  protected void composeImagingStudyImagingStudySeriesComponent(String name, ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
32190    if (element != null) {
32191      open(name);
32192      composeImagingStudyImagingStudySeriesComponentInner(element);
32193      close();
32194    }
32195  }
32196
32197  protected void composeImagingStudyImagingStudySeriesComponentInner(ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
32198      composeBackbone(element);
32199      if (element.hasUidElement()) {
32200        composeOidCore("uid", element.getUidElement(), false);
32201        composeOidExtras("uid", element.getUidElement(), false);
32202      }
32203      if (element.hasNumberElement()) {
32204        composeUnsignedIntCore("number", element.getNumberElement(), false);
32205        composeUnsignedIntExtras("number", element.getNumberElement(), false);
32206      }
32207      if (element.hasModality()) {
32208        composeCoding("modality", element.getModality());
32209      }
32210      if (element.hasDescriptionElement()) {
32211        composeStringCore("description", element.getDescriptionElement(), false);
32212        composeStringExtras("description", element.getDescriptionElement(), false);
32213      }
32214      if (element.hasNumberOfInstancesElement()) {
32215        composeUnsignedIntCore("numberOfInstances", element.getNumberOfInstancesElement(), false);
32216        composeUnsignedIntExtras("numberOfInstances", element.getNumberOfInstancesElement(), false);
32217      }
32218      if (element.hasAvailabilityElement()) {
32219        composeEnumerationCore("availability", element.getAvailabilityElement(), new ImagingStudy.InstanceAvailabilityEnumFactory(), false);
32220        composeEnumerationExtras("availability", element.getAvailabilityElement(), new ImagingStudy.InstanceAvailabilityEnumFactory(), false);
32221      }
32222      if (element.hasEndpoint()) {
32223        openArray("endpoint");
32224        for (Reference e : element.getEndpoint()) 
32225          composeReference(null, e);
32226        closeArray();
32227      };
32228      if (element.hasBodySite()) {
32229        composeCoding("bodySite", element.getBodySite());
32230      }
32231      if (element.hasLaterality()) {
32232        composeCoding("laterality", element.getLaterality());
32233      }
32234      if (element.hasStartedElement()) {
32235        composeDateTimeCore("started", element.getStartedElement(), false);
32236        composeDateTimeExtras("started", element.getStartedElement(), false);
32237      }
32238      if (element.hasPerformer()) {
32239        openArray("performer");
32240        for (Reference e : element.getPerformer()) 
32241          composeReference(null, e);
32242        closeArray();
32243      };
32244      if (element.hasInstance()) {
32245        openArray("instance");
32246        for (ImagingStudy.ImagingStudySeriesInstanceComponent e : element.getInstance()) 
32247          composeImagingStudyImagingStudySeriesInstanceComponent(null, e);
32248        closeArray();
32249      };
32250  }
32251
32252  protected void composeImagingStudyImagingStudySeriesInstanceComponent(String name, ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
32253    if (element != null) {
32254      open(name);
32255      composeImagingStudyImagingStudySeriesInstanceComponentInner(element);
32256      close();
32257    }
32258  }
32259
32260  protected void composeImagingStudyImagingStudySeriesInstanceComponentInner(ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
32261      composeBackbone(element);
32262      if (element.hasUidElement()) {
32263        composeOidCore("uid", element.getUidElement(), false);
32264        composeOidExtras("uid", element.getUidElement(), false);
32265      }
32266      if (element.hasNumberElement()) {
32267        composeUnsignedIntCore("number", element.getNumberElement(), false);
32268        composeUnsignedIntExtras("number", element.getNumberElement(), false);
32269      }
32270      if (element.hasSopClassElement()) {
32271        composeOidCore("sopClass", element.getSopClassElement(), false);
32272        composeOidExtras("sopClass", element.getSopClassElement(), false);
32273      }
32274      if (element.hasTitleElement()) {
32275        composeStringCore("title", element.getTitleElement(), false);
32276        composeStringExtras("title", element.getTitleElement(), false);
32277      }
32278  }
32279
32280  protected void composeImmunization(String name, Immunization element) throws IOException {
32281    if (element != null) {
32282      prop("resourceType", name);
32283      composeImmunizationInner(element);
32284    }
32285  }
32286
32287  protected void composeImmunizationInner(Immunization element) throws IOException {
32288      composeDomainResourceElements(element);
32289      if (element.hasIdentifier()) {
32290        openArray("identifier");
32291        for (Identifier e : element.getIdentifier()) 
32292          composeIdentifier(null, e);
32293        closeArray();
32294      };
32295      if (element.hasStatusElement()) {
32296        composeEnumerationCore("status", element.getStatusElement(), new Immunization.ImmunizationStatusEnumFactory(), false);
32297        composeEnumerationExtras("status", element.getStatusElement(), new Immunization.ImmunizationStatusEnumFactory(), false);
32298      }
32299      if (element.hasNotGivenElement()) {
32300        composeBooleanCore("notGiven", element.getNotGivenElement(), false);
32301        composeBooleanExtras("notGiven", element.getNotGivenElement(), false);
32302      }
32303      if (element.hasVaccineCode()) {
32304        composeCodeableConcept("vaccineCode", element.getVaccineCode());
32305      }
32306      if (element.hasPatient()) {
32307        composeReference("patient", element.getPatient());
32308      }
32309      if (element.hasEncounter()) {
32310        composeReference("encounter", element.getEncounter());
32311      }
32312      if (element.hasDateElement()) {
32313        composeDateTimeCore("date", element.getDateElement(), false);
32314        composeDateTimeExtras("date", element.getDateElement(), false);
32315      }
32316      if (element.hasPrimarySourceElement()) {
32317        composeBooleanCore("primarySource", element.getPrimarySourceElement(), false);
32318        composeBooleanExtras("primarySource", element.getPrimarySourceElement(), false);
32319      }
32320      if (element.hasReportOrigin()) {
32321        composeCodeableConcept("reportOrigin", element.getReportOrigin());
32322      }
32323      if (element.hasLocation()) {
32324        composeReference("location", element.getLocation());
32325      }
32326      if (element.hasManufacturer()) {
32327        composeReference("manufacturer", element.getManufacturer());
32328      }
32329      if (element.hasLotNumberElement()) {
32330        composeStringCore("lotNumber", element.getLotNumberElement(), false);
32331        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
32332      }
32333      if (element.hasExpirationDateElement()) {
32334        composeDateCore("expirationDate", element.getExpirationDateElement(), false);
32335        composeDateExtras("expirationDate", element.getExpirationDateElement(), false);
32336      }
32337      if (element.hasSite()) {
32338        composeCodeableConcept("site", element.getSite());
32339      }
32340      if (element.hasRoute()) {
32341        composeCodeableConcept("route", element.getRoute());
32342      }
32343      if (element.hasDoseQuantity()) {
32344        composeSimpleQuantity("doseQuantity", element.getDoseQuantity());
32345      }
32346      if (element.hasPractitioner()) {
32347        openArray("practitioner");
32348        for (Immunization.ImmunizationPractitionerComponent e : element.getPractitioner()) 
32349          composeImmunizationImmunizationPractitionerComponent(null, e);
32350        closeArray();
32351      };
32352      if (element.hasNote()) {
32353        openArray("note");
32354        for (Annotation e : element.getNote()) 
32355          composeAnnotation(null, e);
32356        closeArray();
32357      };
32358      if (element.hasExplanation()) {
32359        composeImmunizationImmunizationExplanationComponent("explanation", element.getExplanation());
32360      }
32361      if (element.hasReaction()) {
32362        openArray("reaction");
32363        for (Immunization.ImmunizationReactionComponent e : element.getReaction()) 
32364          composeImmunizationImmunizationReactionComponent(null, e);
32365        closeArray();
32366      };
32367      if (element.hasVaccinationProtocol()) {
32368        openArray("vaccinationProtocol");
32369        for (Immunization.ImmunizationVaccinationProtocolComponent e : element.getVaccinationProtocol()) 
32370          composeImmunizationImmunizationVaccinationProtocolComponent(null, e);
32371        closeArray();
32372      };
32373  }
32374
32375  protected void composeImmunizationImmunizationPractitionerComponent(String name, Immunization.ImmunizationPractitionerComponent element) throws IOException {
32376    if (element != null) {
32377      open(name);
32378      composeImmunizationImmunizationPractitionerComponentInner(element);
32379      close();
32380    }
32381  }
32382
32383  protected void composeImmunizationImmunizationPractitionerComponentInner(Immunization.ImmunizationPractitionerComponent element) throws IOException {
32384      composeBackbone(element);
32385      if (element.hasRole()) {
32386        composeCodeableConcept("role", element.getRole());
32387      }
32388      if (element.hasActor()) {
32389        composeReference("actor", element.getActor());
32390      }
32391  }
32392
32393  protected void composeImmunizationImmunizationExplanationComponent(String name, Immunization.ImmunizationExplanationComponent element) throws IOException {
32394    if (element != null) {
32395      open(name);
32396      composeImmunizationImmunizationExplanationComponentInner(element);
32397      close();
32398    }
32399  }
32400
32401  protected void composeImmunizationImmunizationExplanationComponentInner(Immunization.ImmunizationExplanationComponent element) throws IOException {
32402      composeBackbone(element);
32403      if (element.hasReason()) {
32404        openArray("reason");
32405        for (CodeableConcept e : element.getReason()) 
32406          composeCodeableConcept(null, e);
32407        closeArray();
32408      };
32409      if (element.hasReasonNotGiven()) {
32410        openArray("reasonNotGiven");
32411        for (CodeableConcept e : element.getReasonNotGiven()) 
32412          composeCodeableConcept(null, e);
32413        closeArray();
32414      };
32415  }
32416
32417  protected void composeImmunizationImmunizationReactionComponent(String name, Immunization.ImmunizationReactionComponent element) throws IOException {
32418    if (element != null) {
32419      open(name);
32420      composeImmunizationImmunizationReactionComponentInner(element);
32421      close();
32422    }
32423  }
32424
32425  protected void composeImmunizationImmunizationReactionComponentInner(Immunization.ImmunizationReactionComponent element) throws IOException {
32426      composeBackbone(element);
32427      if (element.hasDateElement()) {
32428        composeDateTimeCore("date", element.getDateElement(), false);
32429        composeDateTimeExtras("date", element.getDateElement(), false);
32430      }
32431      if (element.hasDetail()) {
32432        composeReference("detail", element.getDetail());
32433      }
32434      if (element.hasReportedElement()) {
32435        composeBooleanCore("reported", element.getReportedElement(), false);
32436        composeBooleanExtras("reported", element.getReportedElement(), false);
32437      }
32438  }
32439
32440  protected void composeImmunizationImmunizationVaccinationProtocolComponent(String name, Immunization.ImmunizationVaccinationProtocolComponent element) throws IOException {
32441    if (element != null) {
32442      open(name);
32443      composeImmunizationImmunizationVaccinationProtocolComponentInner(element);
32444      close();
32445    }
32446  }
32447
32448  protected void composeImmunizationImmunizationVaccinationProtocolComponentInner(Immunization.ImmunizationVaccinationProtocolComponent element) throws IOException {
32449      composeBackbone(element);
32450      if (element.hasDoseSequenceElement()) {
32451        composePositiveIntCore("doseSequence", element.getDoseSequenceElement(), false);
32452        composePositiveIntExtras("doseSequence", element.getDoseSequenceElement(), false);
32453      }
32454      if (element.hasDescriptionElement()) {
32455        composeStringCore("description", element.getDescriptionElement(), false);
32456        composeStringExtras("description", element.getDescriptionElement(), false);
32457      }
32458      if (element.hasAuthority()) {
32459        composeReference("authority", element.getAuthority());
32460      }
32461      if (element.hasSeriesElement()) {
32462        composeStringCore("series", element.getSeriesElement(), false);
32463        composeStringExtras("series", element.getSeriesElement(), false);
32464      }
32465      if (element.hasSeriesDosesElement()) {
32466        composePositiveIntCore("seriesDoses", element.getSeriesDosesElement(), false);
32467        composePositiveIntExtras("seriesDoses", element.getSeriesDosesElement(), false);
32468      }
32469      if (element.hasTargetDisease()) {
32470        openArray("targetDisease");
32471        for (CodeableConcept e : element.getTargetDisease()) 
32472          composeCodeableConcept(null, e);
32473        closeArray();
32474      };
32475      if (element.hasDoseStatus()) {
32476        composeCodeableConcept("doseStatus", element.getDoseStatus());
32477      }
32478      if (element.hasDoseStatusReason()) {
32479        composeCodeableConcept("doseStatusReason", element.getDoseStatusReason());
32480      }
32481  }
32482
32483  protected void composeImmunizationRecommendation(String name, ImmunizationRecommendation element) throws IOException {
32484    if (element != null) {
32485      prop("resourceType", name);
32486      composeImmunizationRecommendationInner(element);
32487    }
32488  }
32489
32490  protected void composeImmunizationRecommendationInner(ImmunizationRecommendation element) throws IOException {
32491      composeDomainResourceElements(element);
32492      if (element.hasIdentifier()) {
32493        openArray("identifier");
32494        for (Identifier e : element.getIdentifier()) 
32495          composeIdentifier(null, e);
32496        closeArray();
32497      };
32498      if (element.hasPatient()) {
32499        composeReference("patient", element.getPatient());
32500      }
32501      if (element.hasRecommendation()) {
32502        openArray("recommendation");
32503        for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent e : element.getRecommendation()) 
32504          composeImmunizationRecommendationImmunizationRecommendationRecommendationComponent(null, e);
32505        closeArray();
32506      };
32507  }
32508
32509  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
32510    if (element != null) {
32511      open(name);
32512      composeImmunizationRecommendationImmunizationRecommendationRecommendationComponentInner(element);
32513      close();
32514    }
32515  }
32516
32517  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationComponentInner(ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
32518      composeBackbone(element);
32519      if (element.hasDateElement()) {
32520        composeDateTimeCore("date", element.getDateElement(), false);
32521        composeDateTimeExtras("date", element.getDateElement(), false);
32522      }
32523      if (element.hasVaccineCode()) {
32524        composeCodeableConcept("vaccineCode", element.getVaccineCode());
32525      }
32526      if (element.hasTargetDisease()) {
32527        composeCodeableConcept("targetDisease", element.getTargetDisease());
32528      }
32529      if (element.hasDoseNumberElement()) {
32530        composePositiveIntCore("doseNumber", element.getDoseNumberElement(), false);
32531        composePositiveIntExtras("doseNumber", element.getDoseNumberElement(), false);
32532      }
32533      if (element.hasForecastStatus()) {
32534        composeCodeableConcept("forecastStatus", element.getForecastStatus());
32535      }
32536      if (element.hasDateCriterion()) {
32537        openArray("dateCriterion");
32538        for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent e : element.getDateCriterion()) 
32539          composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(null, e);
32540        closeArray();
32541      };
32542      if (element.hasProtocol()) {
32543        composeImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponent("protocol", element.getProtocol());
32544      }
32545      if (element.hasSupportingImmunization()) {
32546        openArray("supportingImmunization");
32547        for (Reference e : element.getSupportingImmunization()) 
32548          composeReference(null, e);
32549        closeArray();
32550      };
32551      if (element.hasSupportingPatientInformation()) {
32552        openArray("supportingPatientInformation");
32553        for (Reference e : element.getSupportingPatientInformation()) 
32554          composeReference(null, e);
32555        closeArray();
32556      };
32557  }
32558
32559  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
32560    if (element != null) {
32561      open(name);
32562      composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentInner(element);
32563      close();
32564    }
32565  }
32566
32567  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentInner(ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
32568      composeBackbone(element);
32569      if (element.hasCode()) {
32570        composeCodeableConcept("code", element.getCode());
32571      }
32572      if (element.hasValueElement()) {
32573        composeDateTimeCore("value", element.getValueElement(), false);
32574        composeDateTimeExtras("value", element.getValueElement(), false);
32575      }
32576  }
32577
32578  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent element) throws IOException {
32579    if (element != null) {
32580      open(name);
32581      composeImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponentInner(element);
32582      close();
32583    }
32584  }
32585
32586  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponentInner(ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent element) throws IOException {
32587      composeBackbone(element);
32588      if (element.hasDoseSequenceElement()) {
32589        composePositiveIntCore("doseSequence", element.getDoseSequenceElement(), false);
32590        composePositiveIntExtras("doseSequence", element.getDoseSequenceElement(), false);
32591      }
32592      if (element.hasDescriptionElement()) {
32593        composeStringCore("description", element.getDescriptionElement(), false);
32594        composeStringExtras("description", element.getDescriptionElement(), false);
32595      }
32596      if (element.hasAuthority()) {
32597        composeReference("authority", element.getAuthority());
32598      }
32599      if (element.hasSeriesElement()) {
32600        composeStringCore("series", element.getSeriesElement(), false);
32601        composeStringExtras("series", element.getSeriesElement(), false);
32602      }
32603  }
32604
32605  protected void composeImplementationGuide(String name, ImplementationGuide element) throws IOException {
32606    if (element != null) {
32607      prop("resourceType", name);
32608      composeImplementationGuideInner(element);
32609    }
32610  }
32611
32612  protected void composeImplementationGuideInner(ImplementationGuide element) throws IOException {
32613      composeDomainResourceElements(element);
32614      if (element.hasUrlElement()) {
32615        composeUriCore("url", element.getUrlElement(), false);
32616        composeUriExtras("url", element.getUrlElement(), false);
32617      }
32618      if (element.hasVersionElement()) {
32619        composeStringCore("version", element.getVersionElement(), false);
32620        composeStringExtras("version", element.getVersionElement(), false);
32621      }
32622      if (element.hasNameElement()) {
32623        composeStringCore("name", element.getNameElement(), false);
32624        composeStringExtras("name", element.getNameElement(), false);
32625      }
32626      if (element.hasStatusElement()) {
32627        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
32628        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
32629      }
32630      if (element.hasExperimentalElement()) {
32631        composeBooleanCore("experimental", element.getExperimentalElement(), false);
32632        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
32633      }
32634      if (element.hasDateElement()) {
32635        composeDateTimeCore("date", element.getDateElement(), false);
32636        composeDateTimeExtras("date", element.getDateElement(), false);
32637      }
32638      if (element.hasPublisherElement()) {
32639        composeStringCore("publisher", element.getPublisherElement(), false);
32640        composeStringExtras("publisher", element.getPublisherElement(), false);
32641      }
32642      if (element.hasContact()) {
32643        openArray("contact");
32644        for (ContactDetail e : element.getContact()) 
32645          composeContactDetail(null, e);
32646        closeArray();
32647      };
32648      if (element.hasDescriptionElement()) {
32649        composeMarkdownCore("description", element.getDescriptionElement(), false);
32650        composeMarkdownExtras("description", element.getDescriptionElement(), false);
32651      }
32652      if (element.hasUseContext()) {
32653        openArray("useContext");
32654        for (UsageContext e : element.getUseContext()) 
32655          composeUsageContext(null, e);
32656        closeArray();
32657      };
32658      if (element.hasJurisdiction()) {
32659        openArray("jurisdiction");
32660        for (CodeableConcept e : element.getJurisdiction()) 
32661          composeCodeableConcept(null, e);
32662        closeArray();
32663      };
32664      if (element.hasCopyrightElement()) {
32665        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
32666        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
32667      }
32668      if (element.hasFhirVersionElement()) {
32669        composeIdCore("fhirVersion", element.getFhirVersionElement(), false);
32670        composeIdExtras("fhirVersion", element.getFhirVersionElement(), false);
32671      }
32672      if (element.hasDependency()) {
32673        openArray("dependency");
32674        for (ImplementationGuide.ImplementationGuideDependencyComponent e : element.getDependency()) 
32675          composeImplementationGuideImplementationGuideDependencyComponent(null, e);
32676        closeArray();
32677      };
32678      if (element.hasPackage()) {
32679        openArray("package");
32680        for (ImplementationGuide.ImplementationGuidePackageComponent e : element.getPackage()) 
32681          composeImplementationGuideImplementationGuidePackageComponent(null, e);
32682        closeArray();
32683      };
32684      if (element.hasGlobal()) {
32685        openArray("global");
32686        for (ImplementationGuide.ImplementationGuideGlobalComponent e : element.getGlobal()) 
32687          composeImplementationGuideImplementationGuideGlobalComponent(null, e);
32688        closeArray();
32689      };
32690      if (element.hasBinary()) {
32691        openArray("binary");
32692        for (UriType e : element.getBinary()) 
32693          composeUriCore(null, e, true);
32694        closeArray();
32695        if (anyHasExtras(element.getBinary())) {
32696          openArray("_binary");
32697          for (UriType e : element.getBinary()) 
32698            composeUriExtras(null, e, true);
32699          closeArray();
32700        }
32701      };
32702      if (element.hasPage()) {
32703        composeImplementationGuideImplementationGuidePageComponent("page", element.getPage());
32704      }
32705  }
32706
32707  protected void composeImplementationGuideImplementationGuideDependencyComponent(String name, ImplementationGuide.ImplementationGuideDependencyComponent element) throws IOException {
32708    if (element != null) {
32709      open(name);
32710      composeImplementationGuideImplementationGuideDependencyComponentInner(element);
32711      close();
32712    }
32713  }
32714
32715  protected void composeImplementationGuideImplementationGuideDependencyComponentInner(ImplementationGuide.ImplementationGuideDependencyComponent element) throws IOException {
32716      composeBackbone(element);
32717      if (element.hasTypeElement()) {
32718        composeEnumerationCore("type", element.getTypeElement(), new ImplementationGuide.GuideDependencyTypeEnumFactory(), false);
32719        composeEnumerationExtras("type", element.getTypeElement(), new ImplementationGuide.GuideDependencyTypeEnumFactory(), false);
32720      }
32721      if (element.hasUriElement()) {
32722        composeUriCore("uri", element.getUriElement(), false);
32723        composeUriExtras("uri", element.getUriElement(), false);
32724      }
32725  }
32726
32727  protected void composeImplementationGuideImplementationGuidePackageComponent(String name, ImplementationGuide.ImplementationGuidePackageComponent element) throws IOException {
32728    if (element != null) {
32729      open(name);
32730      composeImplementationGuideImplementationGuidePackageComponentInner(element);
32731      close();
32732    }
32733  }
32734
32735  protected void composeImplementationGuideImplementationGuidePackageComponentInner(ImplementationGuide.ImplementationGuidePackageComponent element) throws IOException {
32736      composeBackbone(element);
32737      if (element.hasNameElement()) {
32738        composeStringCore("name", element.getNameElement(), false);
32739        composeStringExtras("name", element.getNameElement(), false);
32740      }
32741      if (element.hasDescriptionElement()) {
32742        composeStringCore("description", element.getDescriptionElement(), false);
32743        composeStringExtras("description", element.getDescriptionElement(), false);
32744      }
32745      if (element.hasResource()) {
32746        openArray("resource");
32747        for (ImplementationGuide.ImplementationGuidePackageResourceComponent e : element.getResource()) 
32748          composeImplementationGuideImplementationGuidePackageResourceComponent(null, e);
32749        closeArray();
32750      };
32751  }
32752
32753  protected void composeImplementationGuideImplementationGuidePackageResourceComponent(String name, ImplementationGuide.ImplementationGuidePackageResourceComponent element) throws IOException {
32754    if (element != null) {
32755      open(name);
32756      composeImplementationGuideImplementationGuidePackageResourceComponentInner(element);
32757      close();
32758    }
32759  }
32760
32761  protected void composeImplementationGuideImplementationGuidePackageResourceComponentInner(ImplementationGuide.ImplementationGuidePackageResourceComponent element) throws IOException {
32762      composeBackbone(element);
32763      if (element.hasExampleElement()) {
32764        composeBooleanCore("example", element.getExampleElement(), false);
32765        composeBooleanExtras("example", element.getExampleElement(), false);
32766      }
32767      if (element.hasNameElement()) {
32768        composeStringCore("name", element.getNameElement(), false);
32769        composeStringExtras("name", element.getNameElement(), false);
32770      }
32771      if (element.hasDescriptionElement()) {
32772        composeStringCore("description", element.getDescriptionElement(), false);
32773        composeStringExtras("description", element.getDescriptionElement(), false);
32774      }
32775      if (element.hasAcronymElement()) {
32776        composeStringCore("acronym", element.getAcronymElement(), false);
32777        composeStringExtras("acronym", element.getAcronymElement(), false);
32778      }
32779      if (element.hasSource()) {
32780        composeType("source", element.getSource());
32781      }
32782      if (element.hasExampleFor()) {
32783        composeReference("exampleFor", element.getExampleFor());
32784      }
32785  }
32786
32787  protected void composeImplementationGuideImplementationGuideGlobalComponent(String name, ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
32788    if (element != null) {
32789      open(name);
32790      composeImplementationGuideImplementationGuideGlobalComponentInner(element);
32791      close();
32792    }
32793  }
32794
32795  protected void composeImplementationGuideImplementationGuideGlobalComponentInner(ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
32796      composeBackbone(element);
32797      if (element.hasTypeElement()) {
32798        composeCodeCore("type", element.getTypeElement(), false);
32799        composeCodeExtras("type", element.getTypeElement(), false);
32800      }
32801      if (element.hasProfile()) {
32802        composeReference("profile", element.getProfile());
32803      }
32804  }
32805
32806  protected void composeImplementationGuideImplementationGuidePageComponent(String name, ImplementationGuide.ImplementationGuidePageComponent element) throws IOException {
32807    if (element != null) {
32808      open(name);
32809      composeImplementationGuideImplementationGuidePageComponentInner(element);
32810      close();
32811    }
32812  }
32813
32814  protected void composeImplementationGuideImplementationGuidePageComponentInner(ImplementationGuide.ImplementationGuidePageComponent element) throws IOException {
32815      composeBackbone(element);
32816      if (element.hasSourceElement()) {
32817        composeUriCore("source", element.getSourceElement(), false);
32818        composeUriExtras("source", element.getSourceElement(), false);
32819      }
32820      if (element.hasTitleElement()) {
32821        composeStringCore("title", element.getTitleElement(), false);
32822        composeStringExtras("title", element.getTitleElement(), false);
32823      }
32824      if (element.hasKindElement()) {
32825        composeEnumerationCore("kind", element.getKindElement(), new ImplementationGuide.GuidePageKindEnumFactory(), false);
32826        composeEnumerationExtras("kind", element.getKindElement(), new ImplementationGuide.GuidePageKindEnumFactory(), false);
32827      }
32828      if (element.hasType()) {
32829        openArray("type");
32830        for (CodeType e : element.getType()) 
32831          composeCodeCore(null, e, true);
32832        closeArray();
32833        if (anyHasExtras(element.getType())) {
32834          openArray("_type");
32835          for (CodeType e : element.getType()) 
32836            composeCodeExtras(null, e, true);
32837          closeArray();
32838        }
32839      };
32840      if (element.hasPackage()) {
32841        openArray("package");
32842        for (StringType e : element.getPackage()) 
32843          composeStringCore(null, e, true);
32844        closeArray();
32845        if (anyHasExtras(element.getPackage())) {
32846          openArray("_package");
32847          for (StringType e : element.getPackage()) 
32848            composeStringExtras(null, e, true);
32849          closeArray();
32850        }
32851      };
32852      if (element.hasFormatElement()) {
32853        composeCodeCore("format", element.getFormatElement(), false);
32854        composeCodeExtras("format", element.getFormatElement(), false);
32855      }
32856      if (element.hasPage()) {
32857        openArray("page");
32858        for (ImplementationGuide.ImplementationGuidePageComponent e : element.getPage()) 
32859          composeImplementationGuideImplementationGuidePageComponent(null, e);
32860        closeArray();
32861      };
32862  }
32863
32864  protected void composeLibrary(String name, Library element) throws IOException {
32865    if (element != null) {
32866      prop("resourceType", name);
32867      composeLibraryInner(element);
32868    }
32869  }
32870
32871  protected void composeLibraryInner(Library element) throws IOException {
32872      composeDomainResourceElements(element);
32873      if (element.hasUrlElement()) {
32874        composeUriCore("url", element.getUrlElement(), false);
32875        composeUriExtras("url", element.getUrlElement(), false);
32876      }
32877      if (element.hasIdentifier()) {
32878        openArray("identifier");
32879        for (Identifier e : element.getIdentifier()) 
32880          composeIdentifier(null, e);
32881        closeArray();
32882      };
32883      if (element.hasVersionElement()) {
32884        composeStringCore("version", element.getVersionElement(), false);
32885        composeStringExtras("version", element.getVersionElement(), false);
32886      }
32887      if (element.hasNameElement()) {
32888        composeStringCore("name", element.getNameElement(), false);
32889        composeStringExtras("name", element.getNameElement(), false);
32890      }
32891      if (element.hasTitleElement()) {
32892        composeStringCore("title", element.getTitleElement(), false);
32893        composeStringExtras("title", element.getTitleElement(), false);
32894      }
32895      if (element.hasStatusElement()) {
32896        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
32897        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
32898      }
32899      if (element.hasExperimentalElement()) {
32900        composeBooleanCore("experimental", element.getExperimentalElement(), false);
32901        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
32902      }
32903      if (element.hasType()) {
32904        composeCodeableConcept("type", element.getType());
32905      }
32906      if (element.hasDateElement()) {
32907        composeDateTimeCore("date", element.getDateElement(), false);
32908        composeDateTimeExtras("date", element.getDateElement(), false);
32909      }
32910      if (element.hasPublisherElement()) {
32911        composeStringCore("publisher", element.getPublisherElement(), false);
32912        composeStringExtras("publisher", element.getPublisherElement(), false);
32913      }
32914      if (element.hasDescriptionElement()) {
32915        composeMarkdownCore("description", element.getDescriptionElement(), false);
32916        composeMarkdownExtras("description", element.getDescriptionElement(), false);
32917      }
32918      if (element.hasPurposeElement()) {
32919        composeMarkdownCore("purpose", element.getPurposeElement(), false);
32920        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
32921      }
32922      if (element.hasUsageElement()) {
32923        composeStringCore("usage", element.getUsageElement(), false);
32924        composeStringExtras("usage", element.getUsageElement(), false);
32925      }
32926      if (element.hasApprovalDateElement()) {
32927        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
32928        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
32929      }
32930      if (element.hasLastReviewDateElement()) {
32931        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
32932        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
32933      }
32934      if (element.hasEffectivePeriod()) {
32935        composePeriod("effectivePeriod", element.getEffectivePeriod());
32936      }
32937      if (element.hasUseContext()) {
32938        openArray("useContext");
32939        for (UsageContext e : element.getUseContext()) 
32940          composeUsageContext(null, e);
32941        closeArray();
32942      };
32943      if (element.hasJurisdiction()) {
32944        openArray("jurisdiction");
32945        for (CodeableConcept e : element.getJurisdiction()) 
32946          composeCodeableConcept(null, e);
32947        closeArray();
32948      };
32949      if (element.hasTopic()) {
32950        openArray("topic");
32951        for (CodeableConcept e : element.getTopic()) 
32952          composeCodeableConcept(null, e);
32953        closeArray();
32954      };
32955      if (element.hasContributor()) {
32956        openArray("contributor");
32957        for (Contributor e : element.getContributor()) 
32958          composeContributor(null, e);
32959        closeArray();
32960      };
32961      if (element.hasContact()) {
32962        openArray("contact");
32963        for (ContactDetail e : element.getContact()) 
32964          composeContactDetail(null, e);
32965        closeArray();
32966      };
32967      if (element.hasCopyrightElement()) {
32968        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
32969        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
32970      }
32971      if (element.hasRelatedArtifact()) {
32972        openArray("relatedArtifact");
32973        for (RelatedArtifact e : element.getRelatedArtifact()) 
32974          composeRelatedArtifact(null, e);
32975        closeArray();
32976      };
32977      if (element.hasParameter()) {
32978        openArray("parameter");
32979        for (ParameterDefinition e : element.getParameter()) 
32980          composeParameterDefinition(null, e);
32981        closeArray();
32982      };
32983      if (element.hasDataRequirement()) {
32984        openArray("dataRequirement");
32985        for (DataRequirement e : element.getDataRequirement()) 
32986          composeDataRequirement(null, e);
32987        closeArray();
32988      };
32989      if (element.hasContent()) {
32990        openArray("content");
32991        for (Attachment e : element.getContent()) 
32992          composeAttachment(null, e);
32993        closeArray();
32994      };
32995  }
32996
32997  protected void composeLinkage(String name, Linkage element) throws IOException {
32998    if (element != null) {
32999      prop("resourceType", name);
33000      composeLinkageInner(element);
33001    }
33002  }
33003
33004  protected void composeLinkageInner(Linkage element) throws IOException {
33005      composeDomainResourceElements(element);
33006      if (element.hasActiveElement()) {
33007        composeBooleanCore("active", element.getActiveElement(), false);
33008        composeBooleanExtras("active", element.getActiveElement(), false);
33009      }
33010      if (element.hasAuthor()) {
33011        composeReference("author", element.getAuthor());
33012      }
33013      if (element.hasItem()) {
33014        openArray("item");
33015        for (Linkage.LinkageItemComponent e : element.getItem()) 
33016          composeLinkageLinkageItemComponent(null, e);
33017        closeArray();
33018      };
33019  }
33020
33021  protected void composeLinkageLinkageItemComponent(String name, Linkage.LinkageItemComponent element) throws IOException {
33022    if (element != null) {
33023      open(name);
33024      composeLinkageLinkageItemComponentInner(element);
33025      close();
33026    }
33027  }
33028
33029  protected void composeLinkageLinkageItemComponentInner(Linkage.LinkageItemComponent element) throws IOException {
33030      composeBackbone(element);
33031      if (element.hasTypeElement()) {
33032        composeEnumerationCore("type", element.getTypeElement(), new Linkage.LinkageTypeEnumFactory(), false);
33033        composeEnumerationExtras("type", element.getTypeElement(), new Linkage.LinkageTypeEnumFactory(), false);
33034      }
33035      if (element.hasResource()) {
33036        composeReference("resource", element.getResource());
33037      }
33038  }
33039
33040  protected void composeListResource(String name, ListResource element) throws IOException {
33041    if (element != null) {
33042      prop("resourceType", name);
33043      composeListResourceInner(element);
33044    }
33045  }
33046
33047  protected void composeListResourceInner(ListResource element) throws IOException {
33048      composeDomainResourceElements(element);
33049      if (element.hasIdentifier()) {
33050        openArray("identifier");
33051        for (Identifier e : element.getIdentifier()) 
33052          composeIdentifier(null, e);
33053        closeArray();
33054      };
33055      if (element.hasStatusElement()) {
33056        composeEnumerationCore("status", element.getStatusElement(), new ListResource.ListStatusEnumFactory(), false);
33057        composeEnumerationExtras("status", element.getStatusElement(), new ListResource.ListStatusEnumFactory(), false);
33058      }
33059      if (element.hasModeElement()) {
33060        composeEnumerationCore("mode", element.getModeElement(), new ListResource.ListModeEnumFactory(), false);
33061        composeEnumerationExtras("mode", element.getModeElement(), new ListResource.ListModeEnumFactory(), false);
33062      }
33063      if (element.hasTitleElement()) {
33064        composeStringCore("title", element.getTitleElement(), false);
33065        composeStringExtras("title", element.getTitleElement(), false);
33066      }
33067      if (element.hasCode()) {
33068        composeCodeableConcept("code", element.getCode());
33069      }
33070      if (element.hasSubject()) {
33071        composeReference("subject", element.getSubject());
33072      }
33073      if (element.hasEncounter()) {
33074        composeReference("encounter", element.getEncounter());
33075      }
33076      if (element.hasDateElement()) {
33077        composeDateTimeCore("date", element.getDateElement(), false);
33078        composeDateTimeExtras("date", element.getDateElement(), false);
33079      }
33080      if (element.hasSource()) {
33081        composeReference("source", element.getSource());
33082      }
33083      if (element.hasOrderedBy()) {
33084        composeCodeableConcept("orderedBy", element.getOrderedBy());
33085      }
33086      if (element.hasNote()) {
33087        openArray("note");
33088        for (Annotation e : element.getNote()) 
33089          composeAnnotation(null, e);
33090        closeArray();
33091      };
33092      if (element.hasEntry()) {
33093        openArray("entry");
33094        for (ListResource.ListEntryComponent e : element.getEntry()) 
33095          composeListResourceListEntryComponent(null, e);
33096        closeArray();
33097      };
33098      if (element.hasEmptyReason()) {
33099        composeCodeableConcept("emptyReason", element.getEmptyReason());
33100      }
33101  }
33102
33103  protected void composeListResourceListEntryComponent(String name, ListResource.ListEntryComponent element) throws IOException {
33104    if (element != null) {
33105      open(name);
33106      composeListResourceListEntryComponentInner(element);
33107      close();
33108    }
33109  }
33110
33111  protected void composeListResourceListEntryComponentInner(ListResource.ListEntryComponent element) throws IOException {
33112      composeBackbone(element);
33113      if (element.hasFlag()) {
33114        composeCodeableConcept("flag", element.getFlag());
33115      }
33116      if (element.hasDeletedElement()) {
33117        composeBooleanCore("deleted", element.getDeletedElement(), false);
33118        composeBooleanExtras("deleted", element.getDeletedElement(), false);
33119      }
33120      if (element.hasDateElement()) {
33121        composeDateTimeCore("date", element.getDateElement(), false);
33122        composeDateTimeExtras("date", element.getDateElement(), false);
33123      }
33124      if (element.hasItem()) {
33125        composeReference("item", element.getItem());
33126      }
33127  }
33128
33129  protected void composeLocation(String name, Location element) throws IOException {
33130    if (element != null) {
33131      prop("resourceType", name);
33132      composeLocationInner(element);
33133    }
33134  }
33135
33136  protected void composeLocationInner(Location element) throws IOException {
33137      composeDomainResourceElements(element);
33138      if (element.hasIdentifier()) {
33139        openArray("identifier");
33140        for (Identifier e : element.getIdentifier()) 
33141          composeIdentifier(null, e);
33142        closeArray();
33143      };
33144      if (element.hasStatusElement()) {
33145        composeEnumerationCore("status", element.getStatusElement(), new Location.LocationStatusEnumFactory(), false);
33146        composeEnumerationExtras("status", element.getStatusElement(), new Location.LocationStatusEnumFactory(), false);
33147      }
33148      if (element.hasOperationalStatus()) {
33149        composeCoding("operationalStatus", element.getOperationalStatus());
33150      }
33151      if (element.hasNameElement()) {
33152        composeStringCore("name", element.getNameElement(), false);
33153        composeStringExtras("name", element.getNameElement(), false);
33154      }
33155      if (element.hasAlias()) {
33156        openArray("alias");
33157        for (StringType e : element.getAlias()) 
33158          composeStringCore(null, e, true);
33159        closeArray();
33160        if (anyHasExtras(element.getAlias())) {
33161          openArray("_alias");
33162          for (StringType e : element.getAlias()) 
33163            composeStringExtras(null, e, true);
33164          closeArray();
33165        }
33166      };
33167      if (element.hasDescriptionElement()) {
33168        composeStringCore("description", element.getDescriptionElement(), false);
33169        composeStringExtras("description", element.getDescriptionElement(), false);
33170      }
33171      if (element.hasModeElement()) {
33172        composeEnumerationCore("mode", element.getModeElement(), new Location.LocationModeEnumFactory(), false);
33173        composeEnumerationExtras("mode", element.getModeElement(), new Location.LocationModeEnumFactory(), false);
33174      }
33175      if (element.hasType()) {
33176        composeCodeableConcept("type", element.getType());
33177      }
33178      if (element.hasTelecom()) {
33179        openArray("telecom");
33180        for (ContactPoint e : element.getTelecom()) 
33181          composeContactPoint(null, e);
33182        closeArray();
33183      };
33184      if (element.hasAddress()) {
33185        composeAddress("address", element.getAddress());
33186      }
33187      if (element.hasPhysicalType()) {
33188        composeCodeableConcept("physicalType", element.getPhysicalType());
33189      }
33190      if (element.hasPosition()) {
33191        composeLocationLocationPositionComponent("position", element.getPosition());
33192      }
33193      if (element.hasManagingOrganization()) {
33194        composeReference("managingOrganization", element.getManagingOrganization());
33195      }
33196      if (element.hasPartOf()) {
33197        composeReference("partOf", element.getPartOf());
33198      }
33199      if (element.hasEndpoint()) {
33200        openArray("endpoint");
33201        for (Reference e : element.getEndpoint()) 
33202          composeReference(null, e);
33203        closeArray();
33204      };
33205  }
33206
33207  protected void composeLocationLocationPositionComponent(String name, Location.LocationPositionComponent element) throws IOException {
33208    if (element != null) {
33209      open(name);
33210      composeLocationLocationPositionComponentInner(element);
33211      close();
33212    }
33213  }
33214
33215  protected void composeLocationLocationPositionComponentInner(Location.LocationPositionComponent element) throws IOException {
33216      composeBackbone(element);
33217      if (element.hasLongitudeElement()) {
33218        composeDecimalCore("longitude", element.getLongitudeElement(), false);
33219        composeDecimalExtras("longitude", element.getLongitudeElement(), false);
33220      }
33221      if (element.hasLatitudeElement()) {
33222        composeDecimalCore("latitude", element.getLatitudeElement(), false);
33223        composeDecimalExtras("latitude", element.getLatitudeElement(), false);
33224      }
33225      if (element.hasAltitudeElement()) {
33226        composeDecimalCore("altitude", element.getAltitudeElement(), false);
33227        composeDecimalExtras("altitude", element.getAltitudeElement(), false);
33228      }
33229  }
33230
33231  protected void composeMeasure(String name, Measure element) throws IOException {
33232    if (element != null) {
33233      prop("resourceType", name);
33234      composeMeasureInner(element);
33235    }
33236  }
33237
33238  protected void composeMeasureInner(Measure element) throws IOException {
33239      composeDomainResourceElements(element);
33240      if (element.hasUrlElement()) {
33241        composeUriCore("url", element.getUrlElement(), false);
33242        composeUriExtras("url", element.getUrlElement(), false);
33243      }
33244      if (element.hasIdentifier()) {
33245        openArray("identifier");
33246        for (Identifier e : element.getIdentifier()) 
33247          composeIdentifier(null, e);
33248        closeArray();
33249      };
33250      if (element.hasVersionElement()) {
33251        composeStringCore("version", element.getVersionElement(), false);
33252        composeStringExtras("version", element.getVersionElement(), false);
33253      }
33254      if (element.hasNameElement()) {
33255        composeStringCore("name", element.getNameElement(), false);
33256        composeStringExtras("name", element.getNameElement(), false);
33257      }
33258      if (element.hasTitleElement()) {
33259        composeStringCore("title", element.getTitleElement(), false);
33260        composeStringExtras("title", element.getTitleElement(), false);
33261      }
33262      if (element.hasStatusElement()) {
33263        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
33264        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
33265      }
33266      if (element.hasExperimentalElement()) {
33267        composeBooleanCore("experimental", element.getExperimentalElement(), false);
33268        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
33269      }
33270      if (element.hasDateElement()) {
33271        composeDateTimeCore("date", element.getDateElement(), false);
33272        composeDateTimeExtras("date", element.getDateElement(), false);
33273      }
33274      if (element.hasPublisherElement()) {
33275        composeStringCore("publisher", element.getPublisherElement(), false);
33276        composeStringExtras("publisher", element.getPublisherElement(), false);
33277      }
33278      if (element.hasDescriptionElement()) {
33279        composeMarkdownCore("description", element.getDescriptionElement(), false);
33280        composeMarkdownExtras("description", element.getDescriptionElement(), false);
33281      }
33282      if (element.hasPurposeElement()) {
33283        composeMarkdownCore("purpose", element.getPurposeElement(), false);
33284        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
33285      }
33286      if (element.hasUsageElement()) {
33287        composeStringCore("usage", element.getUsageElement(), false);
33288        composeStringExtras("usage", element.getUsageElement(), false);
33289      }
33290      if (element.hasApprovalDateElement()) {
33291        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
33292        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
33293      }
33294      if (element.hasLastReviewDateElement()) {
33295        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
33296        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
33297      }
33298      if (element.hasEffectivePeriod()) {
33299        composePeriod("effectivePeriod", element.getEffectivePeriod());
33300      }
33301      if (element.hasUseContext()) {
33302        openArray("useContext");
33303        for (UsageContext e : element.getUseContext()) 
33304          composeUsageContext(null, e);
33305        closeArray();
33306      };
33307      if (element.hasJurisdiction()) {
33308        openArray("jurisdiction");
33309        for (CodeableConcept e : element.getJurisdiction()) 
33310          composeCodeableConcept(null, e);
33311        closeArray();
33312      };
33313      if (element.hasTopic()) {
33314        openArray("topic");
33315        for (CodeableConcept e : element.getTopic()) 
33316          composeCodeableConcept(null, e);
33317        closeArray();
33318      };
33319      if (element.hasContributor()) {
33320        openArray("contributor");
33321        for (Contributor e : element.getContributor()) 
33322          composeContributor(null, e);
33323        closeArray();
33324      };
33325      if (element.hasContact()) {
33326        openArray("contact");
33327        for (ContactDetail e : element.getContact()) 
33328          composeContactDetail(null, e);
33329        closeArray();
33330      };
33331      if (element.hasCopyrightElement()) {
33332        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
33333        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
33334      }
33335      if (element.hasRelatedArtifact()) {
33336        openArray("relatedArtifact");
33337        for (RelatedArtifact e : element.getRelatedArtifact()) 
33338          composeRelatedArtifact(null, e);
33339        closeArray();
33340      };
33341      if (element.hasLibrary()) {
33342        openArray("library");
33343        for (Reference e : element.getLibrary()) 
33344          composeReference(null, e);
33345        closeArray();
33346      };
33347      if (element.hasDisclaimerElement()) {
33348        composeMarkdownCore("disclaimer", element.getDisclaimerElement(), false);
33349        composeMarkdownExtras("disclaimer", element.getDisclaimerElement(), false);
33350      }
33351      if (element.hasScoring()) {
33352        composeCodeableConcept("scoring", element.getScoring());
33353      }
33354      if (element.hasCompositeScoring()) {
33355        composeCodeableConcept("compositeScoring", element.getCompositeScoring());
33356      }
33357      if (element.hasType()) {
33358        openArray("type");
33359        for (CodeableConcept e : element.getType()) 
33360          composeCodeableConcept(null, e);
33361        closeArray();
33362      };
33363      if (element.hasRiskAdjustmentElement()) {
33364        composeStringCore("riskAdjustment", element.getRiskAdjustmentElement(), false);
33365        composeStringExtras("riskAdjustment", element.getRiskAdjustmentElement(), false);
33366      }
33367      if (element.hasRateAggregationElement()) {
33368        composeStringCore("rateAggregation", element.getRateAggregationElement(), false);
33369        composeStringExtras("rateAggregation", element.getRateAggregationElement(), false);
33370      }
33371      if (element.hasRationaleElement()) {
33372        composeMarkdownCore("rationale", element.getRationaleElement(), false);
33373        composeMarkdownExtras("rationale", element.getRationaleElement(), false);
33374      }
33375      if (element.hasClinicalRecommendationStatementElement()) {
33376        composeMarkdownCore("clinicalRecommendationStatement", element.getClinicalRecommendationStatementElement(), false);
33377        composeMarkdownExtras("clinicalRecommendationStatement", element.getClinicalRecommendationStatementElement(), false);
33378      }
33379      if (element.hasImprovementNotationElement()) {
33380        composeStringCore("improvementNotation", element.getImprovementNotationElement(), false);
33381        composeStringExtras("improvementNotation", element.getImprovementNotationElement(), false);
33382      }
33383      if (element.hasDefinition()) {
33384        openArray("definition");
33385        for (MarkdownType e : element.getDefinition()) 
33386          composeMarkdownCore(null, e, true);
33387        closeArray();
33388        if (anyHasExtras(element.getDefinition())) {
33389          openArray("_definition");
33390          for (MarkdownType e : element.getDefinition()) 
33391            composeMarkdownExtras(null, e, true);
33392          closeArray();
33393        }
33394      };
33395      if (element.hasGuidanceElement()) {
33396        composeMarkdownCore("guidance", element.getGuidanceElement(), false);
33397        composeMarkdownExtras("guidance", element.getGuidanceElement(), false);
33398      }
33399      if (element.hasSetElement()) {
33400        composeStringCore("set", element.getSetElement(), false);
33401        composeStringExtras("set", element.getSetElement(), false);
33402      }
33403      if (element.hasGroup()) {
33404        openArray("group");
33405        for (Measure.MeasureGroupComponent e : element.getGroup()) 
33406          composeMeasureMeasureGroupComponent(null, e);
33407        closeArray();
33408      };
33409      if (element.hasSupplementalData()) {
33410        openArray("supplementalData");
33411        for (Measure.MeasureSupplementalDataComponent e : element.getSupplementalData()) 
33412          composeMeasureMeasureSupplementalDataComponent(null, e);
33413        closeArray();
33414      };
33415  }
33416
33417  protected void composeMeasureMeasureGroupComponent(String name, Measure.MeasureGroupComponent element) throws IOException {
33418    if (element != null) {
33419      open(name);
33420      composeMeasureMeasureGroupComponentInner(element);
33421      close();
33422    }
33423  }
33424
33425  protected void composeMeasureMeasureGroupComponentInner(Measure.MeasureGroupComponent element) throws IOException {
33426      composeBackbone(element);
33427      if (element.hasIdentifier()) {
33428        composeIdentifier("identifier", element.getIdentifier());
33429      }
33430      if (element.hasNameElement()) {
33431        composeStringCore("name", element.getNameElement(), false);
33432        composeStringExtras("name", element.getNameElement(), false);
33433      }
33434      if (element.hasDescriptionElement()) {
33435        composeStringCore("description", element.getDescriptionElement(), false);
33436        composeStringExtras("description", element.getDescriptionElement(), false);
33437      }
33438      if (element.hasPopulation()) {
33439        openArray("population");
33440        for (Measure.MeasureGroupPopulationComponent e : element.getPopulation()) 
33441          composeMeasureMeasureGroupPopulationComponent(null, e);
33442        closeArray();
33443      };
33444      if (element.hasStratifier()) {
33445        openArray("stratifier");
33446        for (Measure.MeasureGroupStratifierComponent e : element.getStratifier()) 
33447          composeMeasureMeasureGroupStratifierComponent(null, e);
33448        closeArray();
33449      };
33450  }
33451
33452  protected void composeMeasureMeasureGroupPopulationComponent(String name, Measure.MeasureGroupPopulationComponent element) throws IOException {
33453    if (element != null) {
33454      open(name);
33455      composeMeasureMeasureGroupPopulationComponentInner(element);
33456      close();
33457    }
33458  }
33459
33460  protected void composeMeasureMeasureGroupPopulationComponentInner(Measure.MeasureGroupPopulationComponent element) throws IOException {
33461      composeBackbone(element);
33462      if (element.hasIdentifier()) {
33463        composeIdentifier("identifier", element.getIdentifier());
33464      }
33465      if (element.hasCode()) {
33466        composeCodeableConcept("code", element.getCode());
33467      }
33468      if (element.hasNameElement()) {
33469        composeStringCore("name", element.getNameElement(), false);
33470        composeStringExtras("name", element.getNameElement(), false);
33471      }
33472      if (element.hasDescriptionElement()) {
33473        composeStringCore("description", element.getDescriptionElement(), false);
33474        composeStringExtras("description", element.getDescriptionElement(), false);
33475      }
33476      if (element.hasCriteriaElement()) {
33477        composeStringCore("criteria", element.getCriteriaElement(), false);
33478        composeStringExtras("criteria", element.getCriteriaElement(), false);
33479      }
33480  }
33481
33482  protected void composeMeasureMeasureGroupStratifierComponent(String name, Measure.MeasureGroupStratifierComponent element) throws IOException {
33483    if (element != null) {
33484      open(name);
33485      composeMeasureMeasureGroupStratifierComponentInner(element);
33486      close();
33487    }
33488  }
33489
33490  protected void composeMeasureMeasureGroupStratifierComponentInner(Measure.MeasureGroupStratifierComponent element) throws IOException {
33491      composeBackbone(element);
33492      if (element.hasIdentifier()) {
33493        composeIdentifier("identifier", element.getIdentifier());
33494      }
33495      if (element.hasCriteriaElement()) {
33496        composeStringCore("criteria", element.getCriteriaElement(), false);
33497        composeStringExtras("criteria", element.getCriteriaElement(), false);
33498      }
33499      if (element.hasPathElement()) {
33500        composeStringCore("path", element.getPathElement(), false);
33501        composeStringExtras("path", element.getPathElement(), false);
33502      }
33503  }
33504
33505  protected void composeMeasureMeasureSupplementalDataComponent(String name, Measure.MeasureSupplementalDataComponent element) throws IOException {
33506    if (element != null) {
33507      open(name);
33508      composeMeasureMeasureSupplementalDataComponentInner(element);
33509      close();
33510    }
33511  }
33512
33513  protected void composeMeasureMeasureSupplementalDataComponentInner(Measure.MeasureSupplementalDataComponent element) throws IOException {
33514      composeBackbone(element);
33515      if (element.hasIdentifier()) {
33516        composeIdentifier("identifier", element.getIdentifier());
33517      }
33518      if (element.hasUsage()) {
33519        openArray("usage");
33520        for (CodeableConcept e : element.getUsage()) 
33521          composeCodeableConcept(null, e);
33522        closeArray();
33523      };
33524      if (element.hasCriteriaElement()) {
33525        composeStringCore("criteria", element.getCriteriaElement(), false);
33526        composeStringExtras("criteria", element.getCriteriaElement(), false);
33527      }
33528      if (element.hasPathElement()) {
33529        composeStringCore("path", element.getPathElement(), false);
33530        composeStringExtras("path", element.getPathElement(), false);
33531      }
33532  }
33533
33534  protected void composeMeasureReport(String name, MeasureReport element) throws IOException {
33535    if (element != null) {
33536      prop("resourceType", name);
33537      composeMeasureReportInner(element);
33538    }
33539  }
33540
33541  protected void composeMeasureReportInner(MeasureReport element) throws IOException {
33542      composeDomainResourceElements(element);
33543      if (element.hasIdentifier()) {
33544        composeIdentifier("identifier", element.getIdentifier());
33545      }
33546      if (element.hasStatusElement()) {
33547        composeEnumerationCore("status", element.getStatusElement(), new MeasureReport.MeasureReportStatusEnumFactory(), false);
33548        composeEnumerationExtras("status", element.getStatusElement(), new MeasureReport.MeasureReportStatusEnumFactory(), false);
33549      }
33550      if (element.hasTypeElement()) {
33551        composeEnumerationCore("type", element.getTypeElement(), new MeasureReport.MeasureReportTypeEnumFactory(), false);
33552        composeEnumerationExtras("type", element.getTypeElement(), new MeasureReport.MeasureReportTypeEnumFactory(), false);
33553      }
33554      if (element.hasMeasure()) {
33555        composeReference("measure", element.getMeasure());
33556      }
33557      if (element.hasPatient()) {
33558        composeReference("patient", element.getPatient());
33559      }
33560      if (element.hasDateElement()) {
33561        composeDateTimeCore("date", element.getDateElement(), false);
33562        composeDateTimeExtras("date", element.getDateElement(), false);
33563      }
33564      if (element.hasReportingOrganization()) {
33565        composeReference("reportingOrganization", element.getReportingOrganization());
33566      }
33567      if (element.hasPeriod()) {
33568        composePeriod("period", element.getPeriod());
33569      }
33570      if (element.hasGroup()) {
33571        openArray("group");
33572        for (MeasureReport.MeasureReportGroupComponent e : element.getGroup()) 
33573          composeMeasureReportMeasureReportGroupComponent(null, e);
33574        closeArray();
33575      };
33576      if (element.hasEvaluatedResources()) {
33577        composeReference("evaluatedResources", element.getEvaluatedResources());
33578      }
33579  }
33580
33581  protected void composeMeasureReportMeasureReportGroupComponent(String name, MeasureReport.MeasureReportGroupComponent element) throws IOException {
33582    if (element != null) {
33583      open(name);
33584      composeMeasureReportMeasureReportGroupComponentInner(element);
33585      close();
33586    }
33587  }
33588
33589  protected void composeMeasureReportMeasureReportGroupComponentInner(MeasureReport.MeasureReportGroupComponent element) throws IOException {
33590      composeBackbone(element);
33591      if (element.hasIdentifier()) {
33592        composeIdentifier("identifier", element.getIdentifier());
33593      }
33594      if (element.hasPopulation()) {
33595        openArray("population");
33596        for (MeasureReport.MeasureReportGroupPopulationComponent e : element.getPopulation()) 
33597          composeMeasureReportMeasureReportGroupPopulationComponent(null, e);
33598        closeArray();
33599      };
33600      if (element.hasMeasureScoreElement()) {
33601        composeDecimalCore("measureScore", element.getMeasureScoreElement(), false);
33602        composeDecimalExtras("measureScore", element.getMeasureScoreElement(), false);
33603      }
33604      if (element.hasStratifier()) {
33605        openArray("stratifier");
33606        for (MeasureReport.MeasureReportGroupStratifierComponent e : element.getStratifier()) 
33607          composeMeasureReportMeasureReportGroupStratifierComponent(null, e);
33608        closeArray();
33609      };
33610  }
33611
33612  protected void composeMeasureReportMeasureReportGroupPopulationComponent(String name, MeasureReport.MeasureReportGroupPopulationComponent element) throws IOException {
33613    if (element != null) {
33614      open(name);
33615      composeMeasureReportMeasureReportGroupPopulationComponentInner(element);
33616      close();
33617    }
33618  }
33619
33620  protected void composeMeasureReportMeasureReportGroupPopulationComponentInner(MeasureReport.MeasureReportGroupPopulationComponent element) throws IOException {
33621      composeBackbone(element);
33622      if (element.hasIdentifier()) {
33623        composeIdentifier("identifier", element.getIdentifier());
33624      }
33625      if (element.hasCode()) {
33626        composeCodeableConcept("code", element.getCode());
33627      }
33628      if (element.hasCountElement()) {
33629        composeIntegerCore("count", element.getCountElement(), false);
33630        composeIntegerExtras("count", element.getCountElement(), false);
33631      }
33632      if (element.hasPatients()) {
33633        composeReference("patients", element.getPatients());
33634      }
33635  }
33636
33637  protected void composeMeasureReportMeasureReportGroupStratifierComponent(String name, MeasureReport.MeasureReportGroupStratifierComponent element) throws IOException {
33638    if (element != null) {
33639      open(name);
33640      composeMeasureReportMeasureReportGroupStratifierComponentInner(element);
33641      close();
33642    }
33643  }
33644
33645  protected void composeMeasureReportMeasureReportGroupStratifierComponentInner(MeasureReport.MeasureReportGroupStratifierComponent element) throws IOException {
33646      composeBackbone(element);
33647      if (element.hasIdentifier()) {
33648        composeIdentifier("identifier", element.getIdentifier());
33649      }
33650      if (element.hasStratum()) {
33651        openArray("stratum");
33652        for (MeasureReport.StratifierGroupComponent e : element.getStratum()) 
33653          composeMeasureReportStratifierGroupComponent(null, e);
33654        closeArray();
33655      };
33656  }
33657
33658  protected void composeMeasureReportStratifierGroupComponent(String name, MeasureReport.StratifierGroupComponent element) throws IOException {
33659    if (element != null) {
33660      open(name);
33661      composeMeasureReportStratifierGroupComponentInner(element);
33662      close();
33663    }
33664  }
33665
33666  protected void composeMeasureReportStratifierGroupComponentInner(MeasureReport.StratifierGroupComponent element) throws IOException {
33667      composeBackbone(element);
33668      if (element.hasValueElement()) {
33669        composeStringCore("value", element.getValueElement(), false);
33670        composeStringExtras("value", element.getValueElement(), false);
33671      }
33672      if (element.hasPopulation()) {
33673        openArray("population");
33674        for (MeasureReport.StratifierGroupPopulationComponent e : element.getPopulation()) 
33675          composeMeasureReportStratifierGroupPopulationComponent(null, e);
33676        closeArray();
33677      };
33678      if (element.hasMeasureScoreElement()) {
33679        composeDecimalCore("measureScore", element.getMeasureScoreElement(), false);
33680        composeDecimalExtras("measureScore", element.getMeasureScoreElement(), false);
33681      }
33682  }
33683
33684  protected void composeMeasureReportStratifierGroupPopulationComponent(String name, MeasureReport.StratifierGroupPopulationComponent element) throws IOException {
33685    if (element != null) {
33686      open(name);
33687      composeMeasureReportStratifierGroupPopulationComponentInner(element);
33688      close();
33689    }
33690  }
33691
33692  protected void composeMeasureReportStratifierGroupPopulationComponentInner(MeasureReport.StratifierGroupPopulationComponent element) throws IOException {
33693      composeBackbone(element);
33694      if (element.hasIdentifier()) {
33695        composeIdentifier("identifier", element.getIdentifier());
33696      }
33697      if (element.hasCode()) {
33698        composeCodeableConcept("code", element.getCode());
33699      }
33700      if (element.hasCountElement()) {
33701        composeIntegerCore("count", element.getCountElement(), false);
33702        composeIntegerExtras("count", element.getCountElement(), false);
33703      }
33704      if (element.hasPatients()) {
33705        composeReference("patients", element.getPatients());
33706      }
33707  }
33708
33709  protected void composeMedia(String name, Media element) throws IOException {
33710    if (element != null) {
33711      prop("resourceType", name);
33712      composeMediaInner(element);
33713    }
33714  }
33715
33716  protected void composeMediaInner(Media element) throws IOException {
33717      composeDomainResourceElements(element);
33718      if (element.hasIdentifier()) {
33719        openArray("identifier");
33720        for (Identifier e : element.getIdentifier()) 
33721          composeIdentifier(null, e);
33722        closeArray();
33723      };
33724      if (element.hasBasedOn()) {
33725        openArray("basedOn");
33726        for (Reference e : element.getBasedOn()) 
33727          composeReference(null, e);
33728        closeArray();
33729      };
33730      if (element.hasTypeElement()) {
33731        composeEnumerationCore("type", element.getTypeElement(), new Media.DigitalMediaTypeEnumFactory(), false);
33732        composeEnumerationExtras("type", element.getTypeElement(), new Media.DigitalMediaTypeEnumFactory(), false);
33733      }
33734      if (element.hasSubtype()) {
33735        composeCodeableConcept("subtype", element.getSubtype());
33736      }
33737      if (element.hasView()) {
33738        composeCodeableConcept("view", element.getView());
33739      }
33740      if (element.hasSubject()) {
33741        composeReference("subject", element.getSubject());
33742      }
33743      if (element.hasContext()) {
33744        composeReference("context", element.getContext());
33745      }
33746      if (element.hasOccurrence()) {
33747        composeType("occurrence", element.getOccurrence());
33748      }
33749      if (element.hasOperator()) {
33750        composeReference("operator", element.getOperator());
33751      }
33752      if (element.hasReasonCode()) {
33753        openArray("reasonCode");
33754        for (CodeableConcept e : element.getReasonCode()) 
33755          composeCodeableConcept(null, e);
33756        closeArray();
33757      };
33758      if (element.hasBodySite()) {
33759        composeCodeableConcept("bodySite", element.getBodySite());
33760      }
33761      if (element.hasDevice()) {
33762        composeReference("device", element.getDevice());
33763      }
33764      if (element.hasHeightElement()) {
33765        composePositiveIntCore("height", element.getHeightElement(), false);
33766        composePositiveIntExtras("height", element.getHeightElement(), false);
33767      }
33768      if (element.hasWidthElement()) {
33769        composePositiveIntCore("width", element.getWidthElement(), false);
33770        composePositiveIntExtras("width", element.getWidthElement(), false);
33771      }
33772      if (element.hasFramesElement()) {
33773        composePositiveIntCore("frames", element.getFramesElement(), false);
33774        composePositiveIntExtras("frames", element.getFramesElement(), false);
33775      }
33776      if (element.hasDurationElement()) {
33777        composeUnsignedIntCore("duration", element.getDurationElement(), false);
33778        composeUnsignedIntExtras("duration", element.getDurationElement(), false);
33779      }
33780      if (element.hasContent()) {
33781        composeAttachment("content", element.getContent());
33782      }
33783      if (element.hasNote()) {
33784        openArray("note");
33785        for (Annotation e : element.getNote()) 
33786          composeAnnotation(null, e);
33787        closeArray();
33788      };
33789  }
33790
33791  protected void composeMedication(String name, Medication element) throws IOException {
33792    if (element != null) {
33793      prop("resourceType", name);
33794      composeMedicationInner(element);
33795    }
33796  }
33797
33798  protected void composeMedicationInner(Medication element) throws IOException {
33799      composeDomainResourceElements(element);
33800      if (element.hasCode()) {
33801        composeCodeableConcept("code", element.getCode());
33802      }
33803      if (element.hasStatusElement()) {
33804        composeEnumerationCore("status", element.getStatusElement(), new Medication.MedicationStatusEnumFactory(), false);
33805        composeEnumerationExtras("status", element.getStatusElement(), new Medication.MedicationStatusEnumFactory(), false);
33806      }
33807      if (element.hasIsBrandElement()) {
33808        composeBooleanCore("isBrand", element.getIsBrandElement(), false);
33809        composeBooleanExtras("isBrand", element.getIsBrandElement(), false);
33810      }
33811      if (element.hasIsOverTheCounterElement()) {
33812        composeBooleanCore("isOverTheCounter", element.getIsOverTheCounterElement(), false);
33813        composeBooleanExtras("isOverTheCounter", element.getIsOverTheCounterElement(), false);
33814      }
33815      if (element.hasManufacturer()) {
33816        composeReference("manufacturer", element.getManufacturer());
33817      }
33818      if (element.hasForm()) {
33819        composeCodeableConcept("form", element.getForm());
33820      }
33821      if (element.hasIngredient()) {
33822        openArray("ingredient");
33823        for (Medication.MedicationIngredientComponent e : element.getIngredient()) 
33824          composeMedicationMedicationIngredientComponent(null, e);
33825        closeArray();
33826      };
33827      if (element.hasPackage()) {
33828        composeMedicationMedicationPackageComponent("package", element.getPackage());
33829      }
33830      if (element.hasImage()) {
33831        openArray("image");
33832        for (Attachment e : element.getImage()) 
33833          composeAttachment(null, e);
33834        closeArray();
33835      };
33836  }
33837
33838  protected void composeMedicationMedicationIngredientComponent(String name, Medication.MedicationIngredientComponent element) throws IOException {
33839    if (element != null) {
33840      open(name);
33841      composeMedicationMedicationIngredientComponentInner(element);
33842      close();
33843    }
33844  }
33845
33846  protected void composeMedicationMedicationIngredientComponentInner(Medication.MedicationIngredientComponent element) throws IOException {
33847      composeBackbone(element);
33848      if (element.hasItem()) {
33849        composeType("item", element.getItem());
33850      }
33851      if (element.hasIsActiveElement()) {
33852        composeBooleanCore("isActive", element.getIsActiveElement(), false);
33853        composeBooleanExtras("isActive", element.getIsActiveElement(), false);
33854      }
33855      if (element.hasAmount()) {
33856        composeRatio("amount", element.getAmount());
33857      }
33858  }
33859
33860  protected void composeMedicationMedicationPackageComponent(String name, Medication.MedicationPackageComponent element) throws IOException {
33861    if (element != null) {
33862      open(name);
33863      composeMedicationMedicationPackageComponentInner(element);
33864      close();
33865    }
33866  }
33867
33868  protected void composeMedicationMedicationPackageComponentInner(Medication.MedicationPackageComponent element) throws IOException {
33869      composeBackbone(element);
33870      if (element.hasContainer()) {
33871        composeCodeableConcept("container", element.getContainer());
33872      }
33873      if (element.hasContent()) {
33874        openArray("content");
33875        for (Medication.MedicationPackageContentComponent e : element.getContent()) 
33876          composeMedicationMedicationPackageContentComponent(null, e);
33877        closeArray();
33878      };
33879      if (element.hasBatch()) {
33880        openArray("batch");
33881        for (Medication.MedicationPackageBatchComponent e : element.getBatch()) 
33882          composeMedicationMedicationPackageBatchComponent(null, e);
33883        closeArray();
33884      };
33885  }
33886
33887  protected void composeMedicationMedicationPackageContentComponent(String name, Medication.MedicationPackageContentComponent element) throws IOException {
33888    if (element != null) {
33889      open(name);
33890      composeMedicationMedicationPackageContentComponentInner(element);
33891      close();
33892    }
33893  }
33894
33895  protected void composeMedicationMedicationPackageContentComponentInner(Medication.MedicationPackageContentComponent element) throws IOException {
33896      composeBackbone(element);
33897      if (element.hasItem()) {
33898        composeType("item", element.getItem());
33899      }
33900      if (element.hasAmount()) {
33901        composeSimpleQuantity("amount", element.getAmount());
33902      }
33903  }
33904
33905  protected void composeMedicationMedicationPackageBatchComponent(String name, Medication.MedicationPackageBatchComponent element) throws IOException {
33906    if (element != null) {
33907      open(name);
33908      composeMedicationMedicationPackageBatchComponentInner(element);
33909      close();
33910    }
33911  }
33912
33913  protected void composeMedicationMedicationPackageBatchComponentInner(Medication.MedicationPackageBatchComponent element) throws IOException {
33914      composeBackbone(element);
33915      if (element.hasLotNumberElement()) {
33916        composeStringCore("lotNumber", element.getLotNumberElement(), false);
33917        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
33918      }
33919      if (element.hasExpirationDateElement()) {
33920        composeDateTimeCore("expirationDate", element.getExpirationDateElement(), false);
33921        composeDateTimeExtras("expirationDate", element.getExpirationDateElement(), false);
33922      }
33923  }
33924
33925  protected void composeMedicationAdministration(String name, MedicationAdministration element) throws IOException {
33926    if (element != null) {
33927      prop("resourceType", name);
33928      composeMedicationAdministrationInner(element);
33929    }
33930  }
33931
33932  protected void composeMedicationAdministrationInner(MedicationAdministration element) throws IOException {
33933      composeDomainResourceElements(element);
33934      if (element.hasIdentifier()) {
33935        openArray("identifier");
33936        for (Identifier e : element.getIdentifier()) 
33937          composeIdentifier(null, e);
33938        closeArray();
33939      };
33940      if (element.hasDefinition()) {
33941        openArray("definition");
33942        for (Reference e : element.getDefinition()) 
33943          composeReference(null, e);
33944        closeArray();
33945      };
33946      if (element.hasPartOf()) {
33947        openArray("partOf");
33948        for (Reference e : element.getPartOf()) 
33949          composeReference(null, e);
33950        closeArray();
33951      };
33952      if (element.hasStatusElement()) {
33953        composeEnumerationCore("status", element.getStatusElement(), new MedicationAdministration.MedicationAdministrationStatusEnumFactory(), false);
33954        composeEnumerationExtras("status", element.getStatusElement(), new MedicationAdministration.MedicationAdministrationStatusEnumFactory(), false);
33955      }
33956      if (element.hasCategory()) {
33957        composeCodeableConcept("category", element.getCategory());
33958      }
33959      if (element.hasMedication()) {
33960        composeType("medication", element.getMedication());
33961      }
33962      if (element.hasSubject()) {
33963        composeReference("subject", element.getSubject());
33964      }
33965      if (element.hasContext()) {
33966        composeReference("context", element.getContext());
33967      }
33968      if (element.hasSupportingInformation()) {
33969        openArray("supportingInformation");
33970        for (Reference e : element.getSupportingInformation()) 
33971          composeReference(null, e);
33972        closeArray();
33973      };
33974      if (element.hasEffective()) {
33975        composeType("effective", element.getEffective());
33976      }
33977      if (element.hasPerformer()) {
33978        openArray("performer");
33979        for (MedicationAdministration.MedicationAdministrationPerformerComponent e : element.getPerformer()) 
33980          composeMedicationAdministrationMedicationAdministrationPerformerComponent(null, e);
33981        closeArray();
33982      };
33983      if (element.hasNotGivenElement()) {
33984        composeBooleanCore("notGiven", element.getNotGivenElement(), false);
33985        composeBooleanExtras("notGiven", element.getNotGivenElement(), false);
33986      }
33987      if (element.hasReasonNotGiven()) {
33988        openArray("reasonNotGiven");
33989        for (CodeableConcept e : element.getReasonNotGiven()) 
33990          composeCodeableConcept(null, e);
33991        closeArray();
33992      };
33993      if (element.hasReasonCode()) {
33994        openArray("reasonCode");
33995        for (CodeableConcept e : element.getReasonCode()) 
33996          composeCodeableConcept(null, e);
33997        closeArray();
33998      };
33999      if (element.hasReasonReference()) {
34000        openArray("reasonReference");
34001        for (Reference e : element.getReasonReference()) 
34002          composeReference(null, e);
34003        closeArray();
34004      };
34005      if (element.hasPrescription()) {
34006        composeReference("prescription", element.getPrescription());
34007      }
34008      if (element.hasDevice()) {
34009        openArray("device");
34010        for (Reference e : element.getDevice()) 
34011          composeReference(null, e);
34012        closeArray();
34013      };
34014      if (element.hasNote()) {
34015        openArray("note");
34016        for (Annotation e : element.getNote()) 
34017          composeAnnotation(null, e);
34018        closeArray();
34019      };
34020      if (element.hasDosage()) {
34021        composeMedicationAdministrationMedicationAdministrationDosageComponent("dosage", element.getDosage());
34022      }
34023      if (element.hasEventHistory()) {
34024        openArray("eventHistory");
34025        for (Reference e : element.getEventHistory()) 
34026          composeReference(null, e);
34027        closeArray();
34028      };
34029  }
34030
34031  protected void composeMedicationAdministrationMedicationAdministrationPerformerComponent(String name, MedicationAdministration.MedicationAdministrationPerformerComponent element) throws IOException {
34032    if (element != null) {
34033      open(name);
34034      composeMedicationAdministrationMedicationAdministrationPerformerComponentInner(element);
34035      close();
34036    }
34037  }
34038
34039  protected void composeMedicationAdministrationMedicationAdministrationPerformerComponentInner(MedicationAdministration.MedicationAdministrationPerformerComponent element) throws IOException {
34040      composeBackbone(element);
34041      if (element.hasActor()) {
34042        composeReference("actor", element.getActor());
34043      }
34044      if (element.hasOnBehalfOf()) {
34045        composeReference("onBehalfOf", element.getOnBehalfOf());
34046      }
34047  }
34048
34049  protected void composeMedicationAdministrationMedicationAdministrationDosageComponent(String name, MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
34050    if (element != null) {
34051      open(name);
34052      composeMedicationAdministrationMedicationAdministrationDosageComponentInner(element);
34053      close();
34054    }
34055  }
34056
34057  protected void composeMedicationAdministrationMedicationAdministrationDosageComponentInner(MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
34058      composeBackbone(element);
34059      if (element.hasTextElement()) {
34060        composeStringCore("text", element.getTextElement(), false);
34061        composeStringExtras("text", element.getTextElement(), false);
34062      }
34063      if (element.hasSite()) {
34064        composeCodeableConcept("site", element.getSite());
34065      }
34066      if (element.hasRoute()) {
34067        composeCodeableConcept("route", element.getRoute());
34068      }
34069      if (element.hasMethod()) {
34070        composeCodeableConcept("method", element.getMethod());
34071      }
34072      if (element.hasDose()) {
34073        composeSimpleQuantity("dose", element.getDose());
34074      }
34075      if (element.hasRate()) {
34076        composeType("rate", element.getRate());
34077      }
34078  }
34079
34080  protected void composeMedicationDispense(String name, MedicationDispense element) throws IOException {
34081    if (element != null) {
34082      prop("resourceType", name);
34083      composeMedicationDispenseInner(element);
34084    }
34085  }
34086
34087  protected void composeMedicationDispenseInner(MedicationDispense element) throws IOException {
34088      composeDomainResourceElements(element);
34089      if (element.hasIdentifier()) {
34090        openArray("identifier");
34091        for (Identifier e : element.getIdentifier()) 
34092          composeIdentifier(null, e);
34093        closeArray();
34094      };
34095      if (element.hasPartOf()) {
34096        openArray("partOf");
34097        for (Reference e : element.getPartOf()) 
34098          composeReference(null, e);
34099        closeArray();
34100      };
34101      if (element.hasStatusElement()) {
34102        composeEnumerationCore("status", element.getStatusElement(), new MedicationDispense.MedicationDispenseStatusEnumFactory(), false);
34103        composeEnumerationExtras("status", element.getStatusElement(), new MedicationDispense.MedicationDispenseStatusEnumFactory(), false);
34104      }
34105      if (element.hasCategory()) {
34106        composeCodeableConcept("category", element.getCategory());
34107      }
34108      if (element.hasMedication()) {
34109        composeType("medication", element.getMedication());
34110      }
34111      if (element.hasSubject()) {
34112        composeReference("subject", element.getSubject());
34113      }
34114      if (element.hasContext()) {
34115        composeReference("context", element.getContext());
34116      }
34117      if (element.hasSupportingInformation()) {
34118        openArray("supportingInformation");
34119        for (Reference e : element.getSupportingInformation()) 
34120          composeReference(null, e);
34121        closeArray();
34122      };
34123      if (element.hasPerformer()) {
34124        openArray("performer");
34125        for (MedicationDispense.MedicationDispensePerformerComponent e : element.getPerformer()) 
34126          composeMedicationDispenseMedicationDispensePerformerComponent(null, e);
34127        closeArray();
34128      };
34129      if (element.hasAuthorizingPrescription()) {
34130        openArray("authorizingPrescription");
34131        for (Reference e : element.getAuthorizingPrescription()) 
34132          composeReference(null, e);
34133        closeArray();
34134      };
34135      if (element.hasType()) {
34136        composeCodeableConcept("type", element.getType());
34137      }
34138      if (element.hasQuantity()) {
34139        composeSimpleQuantity("quantity", element.getQuantity());
34140      }
34141      if (element.hasDaysSupply()) {
34142        composeSimpleQuantity("daysSupply", element.getDaysSupply());
34143      }
34144      if (element.hasWhenPreparedElement()) {
34145        composeDateTimeCore("whenPrepared", element.getWhenPreparedElement(), false);
34146        composeDateTimeExtras("whenPrepared", element.getWhenPreparedElement(), false);
34147      }
34148      if (element.hasWhenHandedOverElement()) {
34149        composeDateTimeCore("whenHandedOver", element.getWhenHandedOverElement(), false);
34150        composeDateTimeExtras("whenHandedOver", element.getWhenHandedOverElement(), false);
34151      }
34152      if (element.hasDestination()) {
34153        composeReference("destination", element.getDestination());
34154      }
34155      if (element.hasReceiver()) {
34156        openArray("receiver");
34157        for (Reference e : element.getReceiver()) 
34158          composeReference(null, e);
34159        closeArray();
34160      };
34161      if (element.hasNote()) {
34162        openArray("note");
34163        for (Annotation e : element.getNote()) 
34164          composeAnnotation(null, e);
34165        closeArray();
34166      };
34167      if (element.hasDosageInstruction()) {
34168        openArray("dosageInstruction");
34169        for (Dosage e : element.getDosageInstruction()) 
34170          composeDosage(null, e);
34171        closeArray();
34172      };
34173      if (element.hasSubstitution()) {
34174        composeMedicationDispenseMedicationDispenseSubstitutionComponent("substitution", element.getSubstitution());
34175      }
34176      if (element.hasDetectedIssue()) {
34177        openArray("detectedIssue");
34178        for (Reference e : element.getDetectedIssue()) 
34179          composeReference(null, e);
34180        closeArray();
34181      };
34182      if (element.hasNotDoneElement()) {
34183        composeBooleanCore("notDone", element.getNotDoneElement(), false);
34184        composeBooleanExtras("notDone", element.getNotDoneElement(), false);
34185      }
34186      if (element.hasNotDoneReason()) {
34187        composeType("notDoneReason", element.getNotDoneReason());
34188      }
34189      if (element.hasEventHistory()) {
34190        openArray("eventHistory");
34191        for (Reference e : element.getEventHistory()) 
34192          composeReference(null, e);
34193        closeArray();
34194      };
34195  }
34196
34197  protected void composeMedicationDispenseMedicationDispensePerformerComponent(String name, MedicationDispense.MedicationDispensePerformerComponent element) throws IOException {
34198    if (element != null) {
34199      open(name);
34200      composeMedicationDispenseMedicationDispensePerformerComponentInner(element);
34201      close();
34202    }
34203  }
34204
34205  protected void composeMedicationDispenseMedicationDispensePerformerComponentInner(MedicationDispense.MedicationDispensePerformerComponent element) throws IOException {
34206      composeBackbone(element);
34207      if (element.hasActor()) {
34208        composeReference("actor", element.getActor());
34209      }
34210      if (element.hasOnBehalfOf()) {
34211        composeReference("onBehalfOf", element.getOnBehalfOf());
34212      }
34213  }
34214
34215  protected void composeMedicationDispenseMedicationDispenseSubstitutionComponent(String name, MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
34216    if (element != null) {
34217      open(name);
34218      composeMedicationDispenseMedicationDispenseSubstitutionComponentInner(element);
34219      close();
34220    }
34221  }
34222
34223  protected void composeMedicationDispenseMedicationDispenseSubstitutionComponentInner(MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
34224      composeBackbone(element);
34225      if (element.hasWasSubstitutedElement()) {
34226        composeBooleanCore("wasSubstituted", element.getWasSubstitutedElement(), false);
34227        composeBooleanExtras("wasSubstituted", element.getWasSubstitutedElement(), false);
34228      }
34229      if (element.hasType()) {
34230        composeCodeableConcept("type", element.getType());
34231      }
34232      if (element.hasReason()) {
34233        openArray("reason");
34234        for (CodeableConcept e : element.getReason()) 
34235          composeCodeableConcept(null, e);
34236        closeArray();
34237      };
34238      if (element.hasResponsibleParty()) {
34239        openArray("responsibleParty");
34240        for (Reference e : element.getResponsibleParty()) 
34241          composeReference(null, e);
34242        closeArray();
34243      };
34244  }
34245
34246  protected void composeMedicationRequest(String name, MedicationRequest element) throws IOException {
34247    if (element != null) {
34248      prop("resourceType", name);
34249      composeMedicationRequestInner(element);
34250    }
34251  }
34252
34253  protected void composeMedicationRequestInner(MedicationRequest element) throws IOException {
34254      composeDomainResourceElements(element);
34255      if (element.hasIdentifier()) {
34256        openArray("identifier");
34257        for (Identifier e : element.getIdentifier()) 
34258          composeIdentifier(null, e);
34259        closeArray();
34260      };
34261      if (element.hasDefinition()) {
34262        openArray("definition");
34263        for (Reference e : element.getDefinition()) 
34264          composeReference(null, e);
34265        closeArray();
34266      };
34267      if (element.hasBasedOn()) {
34268        openArray("basedOn");
34269        for (Reference e : element.getBasedOn()) 
34270          composeReference(null, e);
34271        closeArray();
34272      };
34273      if (element.hasGroupIdentifier()) {
34274        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
34275      }
34276      if (element.hasStatusElement()) {
34277        composeEnumerationCore("status", element.getStatusElement(), new MedicationRequest.MedicationRequestStatusEnumFactory(), false);
34278        composeEnumerationExtras("status", element.getStatusElement(), new MedicationRequest.MedicationRequestStatusEnumFactory(), false);
34279      }
34280      if (element.hasIntentElement()) {
34281        composeEnumerationCore("intent", element.getIntentElement(), new MedicationRequest.MedicationRequestIntentEnumFactory(), false);
34282        composeEnumerationExtras("intent", element.getIntentElement(), new MedicationRequest.MedicationRequestIntentEnumFactory(), false);
34283      }
34284      if (element.hasCategory()) {
34285        composeCodeableConcept("category", element.getCategory());
34286      }
34287      if (element.hasPriorityElement()) {
34288        composeEnumerationCore("priority", element.getPriorityElement(), new MedicationRequest.MedicationRequestPriorityEnumFactory(), false);
34289        composeEnumerationExtras("priority", element.getPriorityElement(), new MedicationRequest.MedicationRequestPriorityEnumFactory(), false);
34290      }
34291      if (element.hasMedication()) {
34292        composeType("medication", element.getMedication());
34293      }
34294      if (element.hasSubject()) {
34295        composeReference("subject", element.getSubject());
34296      }
34297      if (element.hasContext()) {
34298        composeReference("context", element.getContext());
34299      }
34300      if (element.hasSupportingInformation()) {
34301        openArray("supportingInformation");
34302        for (Reference e : element.getSupportingInformation()) 
34303          composeReference(null, e);
34304        closeArray();
34305      };
34306      if (element.hasAuthoredOnElement()) {
34307        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
34308        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
34309      }
34310      if (element.hasRequester()) {
34311        composeMedicationRequestMedicationRequestRequesterComponent("requester", element.getRequester());
34312      }
34313      if (element.hasRecorder()) {
34314        composeReference("recorder", element.getRecorder());
34315      }
34316      if (element.hasReasonCode()) {
34317        openArray("reasonCode");
34318        for (CodeableConcept e : element.getReasonCode()) 
34319          composeCodeableConcept(null, e);
34320        closeArray();
34321      };
34322      if (element.hasReasonReference()) {
34323        openArray("reasonReference");
34324        for (Reference e : element.getReasonReference()) 
34325          composeReference(null, e);
34326        closeArray();
34327      };
34328      if (element.hasNote()) {
34329        openArray("note");
34330        for (Annotation e : element.getNote()) 
34331          composeAnnotation(null, e);
34332        closeArray();
34333      };
34334      if (element.hasDosageInstruction()) {
34335        openArray("dosageInstruction");
34336        for (Dosage e : element.getDosageInstruction()) 
34337          composeDosage(null, e);
34338        closeArray();
34339      };
34340      if (element.hasDispenseRequest()) {
34341        composeMedicationRequestMedicationRequestDispenseRequestComponent("dispenseRequest", element.getDispenseRequest());
34342      }
34343      if (element.hasSubstitution()) {
34344        composeMedicationRequestMedicationRequestSubstitutionComponent("substitution", element.getSubstitution());
34345      }
34346      if (element.hasPriorPrescription()) {
34347        composeReference("priorPrescription", element.getPriorPrescription());
34348      }
34349      if (element.hasDetectedIssue()) {
34350        openArray("detectedIssue");
34351        for (Reference e : element.getDetectedIssue()) 
34352          composeReference(null, e);
34353        closeArray();
34354      };
34355      if (element.hasEventHistory()) {
34356        openArray("eventHistory");
34357        for (Reference e : element.getEventHistory()) 
34358          composeReference(null, e);
34359        closeArray();
34360      };
34361  }
34362
34363  protected void composeMedicationRequestMedicationRequestRequesterComponent(String name, MedicationRequest.MedicationRequestRequesterComponent element) throws IOException {
34364    if (element != null) {
34365      open(name);
34366      composeMedicationRequestMedicationRequestRequesterComponentInner(element);
34367      close();
34368    }
34369  }
34370
34371  protected void composeMedicationRequestMedicationRequestRequesterComponentInner(MedicationRequest.MedicationRequestRequesterComponent element) throws IOException {
34372      composeBackbone(element);
34373      if (element.hasAgent()) {
34374        composeReference("agent", element.getAgent());
34375      }
34376      if (element.hasOnBehalfOf()) {
34377        composeReference("onBehalfOf", element.getOnBehalfOf());
34378      }
34379  }
34380
34381  protected void composeMedicationRequestMedicationRequestDispenseRequestComponent(String name, MedicationRequest.MedicationRequestDispenseRequestComponent element) throws IOException {
34382    if (element != null) {
34383      open(name);
34384      composeMedicationRequestMedicationRequestDispenseRequestComponentInner(element);
34385      close();
34386    }
34387  }
34388
34389  protected void composeMedicationRequestMedicationRequestDispenseRequestComponentInner(MedicationRequest.MedicationRequestDispenseRequestComponent element) throws IOException {
34390      composeBackbone(element);
34391      if (element.hasValidityPeriod()) {
34392        composePeriod("validityPeriod", element.getValidityPeriod());
34393      }
34394      if (element.hasNumberOfRepeatsAllowedElement()) {
34395        composePositiveIntCore("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement(), false);
34396        composePositiveIntExtras("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement(), false);
34397      }
34398      if (element.hasQuantity()) {
34399        composeSimpleQuantity("quantity", element.getQuantity());
34400      }
34401      if (element.hasExpectedSupplyDuration()) {
34402        composeDuration("expectedSupplyDuration", element.getExpectedSupplyDuration());
34403      }
34404      if (element.hasPerformer()) {
34405        composeReference("performer", element.getPerformer());
34406      }
34407  }
34408
34409  protected void composeMedicationRequestMedicationRequestSubstitutionComponent(String name, MedicationRequest.MedicationRequestSubstitutionComponent element) throws IOException {
34410    if (element != null) {
34411      open(name);
34412      composeMedicationRequestMedicationRequestSubstitutionComponentInner(element);
34413      close();
34414    }
34415  }
34416
34417  protected void composeMedicationRequestMedicationRequestSubstitutionComponentInner(MedicationRequest.MedicationRequestSubstitutionComponent element) throws IOException {
34418      composeBackbone(element);
34419      if (element.hasAllowedElement()) {
34420        composeBooleanCore("allowed", element.getAllowedElement(), false);
34421        composeBooleanExtras("allowed", element.getAllowedElement(), false);
34422      }
34423      if (element.hasReason()) {
34424        composeCodeableConcept("reason", element.getReason());
34425      }
34426  }
34427
34428  protected void composeMedicationStatement(String name, MedicationStatement element) throws IOException {
34429    if (element != null) {
34430      prop("resourceType", name);
34431      composeMedicationStatementInner(element);
34432    }
34433  }
34434
34435  protected void composeMedicationStatementInner(MedicationStatement element) throws IOException {
34436      composeDomainResourceElements(element);
34437      if (element.hasIdentifier()) {
34438        openArray("identifier");
34439        for (Identifier e : element.getIdentifier()) 
34440          composeIdentifier(null, e);
34441        closeArray();
34442      };
34443      if (element.hasBasedOn()) {
34444        openArray("basedOn");
34445        for (Reference e : element.getBasedOn()) 
34446          composeReference(null, e);
34447        closeArray();
34448      };
34449      if (element.hasPartOf()) {
34450        openArray("partOf");
34451        for (Reference e : element.getPartOf()) 
34452          composeReference(null, e);
34453        closeArray();
34454      };
34455      if (element.hasContext()) {
34456        composeReference("context", element.getContext());
34457      }
34458      if (element.hasStatusElement()) {
34459        composeEnumerationCore("status", element.getStatusElement(), new MedicationStatement.MedicationStatementStatusEnumFactory(), false);
34460        composeEnumerationExtras("status", element.getStatusElement(), new MedicationStatement.MedicationStatementStatusEnumFactory(), false);
34461      }
34462      if (element.hasCategory()) {
34463        composeCodeableConcept("category", element.getCategory());
34464      }
34465      if (element.hasMedication()) {
34466        composeType("medication", element.getMedication());
34467      }
34468      if (element.hasEffective()) {
34469        composeType("effective", element.getEffective());
34470      }
34471      if (element.hasDateAssertedElement()) {
34472        composeDateTimeCore("dateAsserted", element.getDateAssertedElement(), false);
34473        composeDateTimeExtras("dateAsserted", element.getDateAssertedElement(), false);
34474      }
34475      if (element.hasInformationSource()) {
34476        composeReference("informationSource", element.getInformationSource());
34477      }
34478      if (element.hasSubject()) {
34479        composeReference("subject", element.getSubject());
34480      }
34481      if (element.hasDerivedFrom()) {
34482        openArray("derivedFrom");
34483        for (Reference e : element.getDerivedFrom()) 
34484          composeReference(null, e);
34485        closeArray();
34486      };
34487      if (element.hasTakenElement()) {
34488        composeEnumerationCore("taken", element.getTakenElement(), new MedicationStatement.MedicationStatementTakenEnumFactory(), false);
34489        composeEnumerationExtras("taken", element.getTakenElement(), new MedicationStatement.MedicationStatementTakenEnumFactory(), false);
34490      }
34491      if (element.hasReasonNotTaken()) {
34492        openArray("reasonNotTaken");
34493        for (CodeableConcept e : element.getReasonNotTaken()) 
34494          composeCodeableConcept(null, e);
34495        closeArray();
34496      };
34497      if (element.hasReasonCode()) {
34498        openArray("reasonCode");
34499        for (CodeableConcept e : element.getReasonCode()) 
34500          composeCodeableConcept(null, e);
34501        closeArray();
34502      };
34503      if (element.hasReasonReference()) {
34504        openArray("reasonReference");
34505        for (Reference e : element.getReasonReference()) 
34506          composeReference(null, e);
34507        closeArray();
34508      };
34509      if (element.hasNote()) {
34510        openArray("note");
34511        for (Annotation e : element.getNote()) 
34512          composeAnnotation(null, e);
34513        closeArray();
34514      };
34515      if (element.hasDosage()) {
34516        openArray("dosage");
34517        for (Dosage e : element.getDosage()) 
34518          composeDosage(null, e);
34519        closeArray();
34520      };
34521  }
34522
34523  protected void composeMessageDefinition(String name, MessageDefinition element) throws IOException {
34524    if (element != null) {
34525      prop("resourceType", name);
34526      composeMessageDefinitionInner(element);
34527    }
34528  }
34529
34530  protected void composeMessageDefinitionInner(MessageDefinition element) throws IOException {
34531      composeDomainResourceElements(element);
34532      if (element.hasUrlElement()) {
34533        composeUriCore("url", element.getUrlElement(), false);
34534        composeUriExtras("url", element.getUrlElement(), false);
34535      }
34536      if (element.hasIdentifier()) {
34537        composeIdentifier("identifier", element.getIdentifier());
34538      }
34539      if (element.hasVersionElement()) {
34540        composeStringCore("version", element.getVersionElement(), false);
34541        composeStringExtras("version", element.getVersionElement(), false);
34542      }
34543      if (element.hasNameElement()) {
34544        composeStringCore("name", element.getNameElement(), false);
34545        composeStringExtras("name", element.getNameElement(), false);
34546      }
34547      if (element.hasTitleElement()) {
34548        composeStringCore("title", element.getTitleElement(), false);
34549        composeStringExtras("title", element.getTitleElement(), false);
34550      }
34551      if (element.hasStatusElement()) {
34552        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
34553        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
34554      }
34555      if (element.hasExperimentalElement()) {
34556        composeBooleanCore("experimental", element.getExperimentalElement(), false);
34557        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
34558      }
34559      if (element.hasDateElement()) {
34560        composeDateTimeCore("date", element.getDateElement(), false);
34561        composeDateTimeExtras("date", element.getDateElement(), false);
34562      }
34563      if (element.hasPublisherElement()) {
34564        composeStringCore("publisher", element.getPublisherElement(), false);
34565        composeStringExtras("publisher", element.getPublisherElement(), false);
34566      }
34567      if (element.hasContact()) {
34568        openArray("contact");
34569        for (ContactDetail e : element.getContact()) 
34570          composeContactDetail(null, e);
34571        closeArray();
34572      };
34573      if (element.hasDescriptionElement()) {
34574        composeMarkdownCore("description", element.getDescriptionElement(), false);
34575        composeMarkdownExtras("description", element.getDescriptionElement(), false);
34576      }
34577      if (element.hasUseContext()) {
34578        openArray("useContext");
34579        for (UsageContext e : element.getUseContext()) 
34580          composeUsageContext(null, e);
34581        closeArray();
34582      };
34583      if (element.hasJurisdiction()) {
34584        openArray("jurisdiction");
34585        for (CodeableConcept e : element.getJurisdiction()) 
34586          composeCodeableConcept(null, e);
34587        closeArray();
34588      };
34589      if (element.hasPurposeElement()) {
34590        composeMarkdownCore("purpose", element.getPurposeElement(), false);
34591        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
34592      }
34593      if (element.hasCopyrightElement()) {
34594        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
34595        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
34596      }
34597      if (element.hasBase()) {
34598        composeReference("base", element.getBase());
34599      }
34600      if (element.hasParent()) {
34601        openArray("parent");
34602        for (Reference e : element.getParent()) 
34603          composeReference(null, e);
34604        closeArray();
34605      };
34606      if (element.hasReplaces()) {
34607        openArray("replaces");
34608        for (Reference e : element.getReplaces()) 
34609          composeReference(null, e);
34610        closeArray();
34611      };
34612      if (element.hasEvent()) {
34613        composeCoding("event", element.getEvent());
34614      }
34615      if (element.hasCategoryElement()) {
34616        composeEnumerationCore("category", element.getCategoryElement(), new MessageDefinition.MessageSignificanceCategoryEnumFactory(), false);
34617        composeEnumerationExtras("category", element.getCategoryElement(), new MessageDefinition.MessageSignificanceCategoryEnumFactory(), false);
34618      }
34619      if (element.hasFocus()) {
34620        openArray("focus");
34621        for (MessageDefinition.MessageDefinitionFocusComponent e : element.getFocus()) 
34622          composeMessageDefinitionMessageDefinitionFocusComponent(null, e);
34623        closeArray();
34624      };
34625      if (element.hasResponseRequiredElement()) {
34626        composeBooleanCore("responseRequired", element.getResponseRequiredElement(), false);
34627        composeBooleanExtras("responseRequired", element.getResponseRequiredElement(), false);
34628      }
34629      if (element.hasAllowedResponse()) {
34630        openArray("allowedResponse");
34631        for (MessageDefinition.MessageDefinitionAllowedResponseComponent e : element.getAllowedResponse()) 
34632          composeMessageDefinitionMessageDefinitionAllowedResponseComponent(null, e);
34633        closeArray();
34634      };
34635  }
34636
34637  protected void composeMessageDefinitionMessageDefinitionFocusComponent(String name, MessageDefinition.MessageDefinitionFocusComponent element) throws IOException {
34638    if (element != null) {
34639      open(name);
34640      composeMessageDefinitionMessageDefinitionFocusComponentInner(element);
34641      close();
34642    }
34643  }
34644
34645  protected void composeMessageDefinitionMessageDefinitionFocusComponentInner(MessageDefinition.MessageDefinitionFocusComponent element) throws IOException {
34646      composeBackbone(element);
34647      if (element.hasCodeElement()) {
34648        composeCodeCore("code", element.getCodeElement(), false);
34649        composeCodeExtras("code", element.getCodeElement(), false);
34650      }
34651      if (element.hasProfile()) {
34652        composeReference("profile", element.getProfile());
34653      }
34654      if (element.hasMinElement()) {
34655        composeUnsignedIntCore("min", element.getMinElement(), false);
34656        composeUnsignedIntExtras("min", element.getMinElement(), false);
34657      }
34658      if (element.hasMaxElement()) {
34659        composeStringCore("max", element.getMaxElement(), false);
34660        composeStringExtras("max", element.getMaxElement(), false);
34661      }
34662  }
34663
34664  protected void composeMessageDefinitionMessageDefinitionAllowedResponseComponent(String name, MessageDefinition.MessageDefinitionAllowedResponseComponent element) throws IOException {
34665    if (element != null) {
34666      open(name);
34667      composeMessageDefinitionMessageDefinitionAllowedResponseComponentInner(element);
34668      close();
34669    }
34670  }
34671
34672  protected void composeMessageDefinitionMessageDefinitionAllowedResponseComponentInner(MessageDefinition.MessageDefinitionAllowedResponseComponent element) throws IOException {
34673      composeBackbone(element);
34674      if (element.hasMessage()) {
34675        composeReference("message", element.getMessage());
34676      }
34677      if (element.hasSituationElement()) {
34678        composeMarkdownCore("situation", element.getSituationElement(), false);
34679        composeMarkdownExtras("situation", element.getSituationElement(), false);
34680      }
34681  }
34682
34683  protected void composeMessageHeader(String name, MessageHeader element) throws IOException {
34684    if (element != null) {
34685      prop("resourceType", name);
34686      composeMessageHeaderInner(element);
34687    }
34688  }
34689
34690  protected void composeMessageHeaderInner(MessageHeader element) throws IOException {
34691      composeDomainResourceElements(element);
34692      if (element.hasEvent()) {
34693        composeCoding("event", element.getEvent());
34694      }
34695      if (element.hasDestination()) {
34696        openArray("destination");
34697        for (MessageHeader.MessageDestinationComponent e : element.getDestination()) 
34698          composeMessageHeaderMessageDestinationComponent(null, e);
34699        closeArray();
34700      };
34701      if (element.hasReceiver()) {
34702        composeReference("receiver", element.getReceiver());
34703      }
34704      if (element.hasSender()) {
34705        composeReference("sender", element.getSender());
34706      }
34707      if (element.hasTimestampElement()) {
34708        composeInstantCore("timestamp", element.getTimestampElement(), false);
34709        composeInstantExtras("timestamp", element.getTimestampElement(), false);
34710      }
34711      if (element.hasEnterer()) {
34712        composeReference("enterer", element.getEnterer());
34713      }
34714      if (element.hasAuthor()) {
34715        composeReference("author", element.getAuthor());
34716      }
34717      if (element.hasSource()) {
34718        composeMessageHeaderMessageSourceComponent("source", element.getSource());
34719      }
34720      if (element.hasResponsible()) {
34721        composeReference("responsible", element.getResponsible());
34722      }
34723      if (element.hasReason()) {
34724        composeCodeableConcept("reason", element.getReason());
34725      }
34726      if (element.hasResponse()) {
34727        composeMessageHeaderMessageHeaderResponseComponent("response", element.getResponse());
34728      }
34729      if (element.hasFocus()) {
34730        openArray("focus");
34731        for (Reference e : element.getFocus()) 
34732          composeReference(null, e);
34733        closeArray();
34734      };
34735  }
34736
34737  protected void composeMessageHeaderMessageDestinationComponent(String name, MessageHeader.MessageDestinationComponent element) throws IOException {
34738    if (element != null) {
34739      open(name);
34740      composeMessageHeaderMessageDestinationComponentInner(element);
34741      close();
34742    }
34743  }
34744
34745  protected void composeMessageHeaderMessageDestinationComponentInner(MessageHeader.MessageDestinationComponent element) throws IOException {
34746      composeBackbone(element);
34747      if (element.hasNameElement()) {
34748        composeStringCore("name", element.getNameElement(), false);
34749        composeStringExtras("name", element.getNameElement(), false);
34750      }
34751      if (element.hasTarget()) {
34752        composeReference("target", element.getTarget());
34753      }
34754      if (element.hasEndpointElement()) {
34755        composeUriCore("endpoint", element.getEndpointElement(), false);
34756        composeUriExtras("endpoint", element.getEndpointElement(), false);
34757      }
34758  }
34759
34760  protected void composeMessageHeaderMessageSourceComponent(String name, MessageHeader.MessageSourceComponent element) throws IOException {
34761    if (element != null) {
34762      open(name);
34763      composeMessageHeaderMessageSourceComponentInner(element);
34764      close();
34765    }
34766  }
34767
34768  protected void composeMessageHeaderMessageSourceComponentInner(MessageHeader.MessageSourceComponent element) throws IOException {
34769      composeBackbone(element);
34770      if (element.hasNameElement()) {
34771        composeStringCore("name", element.getNameElement(), false);
34772        composeStringExtras("name", element.getNameElement(), false);
34773      }
34774      if (element.hasSoftwareElement()) {
34775        composeStringCore("software", element.getSoftwareElement(), false);
34776        composeStringExtras("software", element.getSoftwareElement(), false);
34777      }
34778      if (element.hasVersionElement()) {
34779        composeStringCore("version", element.getVersionElement(), false);
34780        composeStringExtras("version", element.getVersionElement(), false);
34781      }
34782      if (element.hasContact()) {
34783        composeContactPoint("contact", element.getContact());
34784      }
34785      if (element.hasEndpointElement()) {
34786        composeUriCore("endpoint", element.getEndpointElement(), false);
34787        composeUriExtras("endpoint", element.getEndpointElement(), false);
34788      }
34789  }
34790
34791  protected void composeMessageHeaderMessageHeaderResponseComponent(String name, MessageHeader.MessageHeaderResponseComponent element) throws IOException {
34792    if (element != null) {
34793      open(name);
34794      composeMessageHeaderMessageHeaderResponseComponentInner(element);
34795      close();
34796    }
34797  }
34798
34799  protected void composeMessageHeaderMessageHeaderResponseComponentInner(MessageHeader.MessageHeaderResponseComponent element) throws IOException {
34800      composeBackbone(element);
34801      if (element.hasIdentifierElement()) {
34802        composeIdCore("identifier", element.getIdentifierElement(), false);
34803        composeIdExtras("identifier", element.getIdentifierElement(), false);
34804      }
34805      if (element.hasCodeElement()) {
34806        composeEnumerationCore("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory(), false);
34807        composeEnumerationExtras("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory(), false);
34808      }
34809      if (element.hasDetails()) {
34810        composeReference("details", element.getDetails());
34811      }
34812  }
34813
34814  protected void composeNamingSystem(String name, NamingSystem element) throws IOException {
34815    if (element != null) {
34816      prop("resourceType", name);
34817      composeNamingSystemInner(element);
34818    }
34819  }
34820
34821  protected void composeNamingSystemInner(NamingSystem element) throws IOException {
34822      composeDomainResourceElements(element);
34823      if (element.hasNameElement()) {
34824        composeStringCore("name", element.getNameElement(), false);
34825        composeStringExtras("name", element.getNameElement(), false);
34826      }
34827      if (element.hasStatusElement()) {
34828        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
34829        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
34830      }
34831      if (element.hasKindElement()) {
34832        composeEnumerationCore("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory(), false);
34833        composeEnumerationExtras("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory(), false);
34834      }
34835      if (element.hasDateElement()) {
34836        composeDateTimeCore("date", element.getDateElement(), false);
34837        composeDateTimeExtras("date", element.getDateElement(), false);
34838      }
34839      if (element.hasPublisherElement()) {
34840        composeStringCore("publisher", element.getPublisherElement(), false);
34841        composeStringExtras("publisher", element.getPublisherElement(), false);
34842      }
34843      if (element.hasContact()) {
34844        openArray("contact");
34845        for (ContactDetail e : element.getContact()) 
34846          composeContactDetail(null, e);
34847        closeArray();
34848      };
34849      if (element.hasResponsibleElement()) {
34850        composeStringCore("responsible", element.getResponsibleElement(), false);
34851        composeStringExtras("responsible", element.getResponsibleElement(), false);
34852      }
34853      if (element.hasType()) {
34854        composeCodeableConcept("type", element.getType());
34855      }
34856      if (element.hasDescriptionElement()) {
34857        composeMarkdownCore("description", element.getDescriptionElement(), false);
34858        composeMarkdownExtras("description", element.getDescriptionElement(), false);
34859      }
34860      if (element.hasUseContext()) {
34861        openArray("useContext");
34862        for (UsageContext e : element.getUseContext()) 
34863          composeUsageContext(null, e);
34864        closeArray();
34865      };
34866      if (element.hasJurisdiction()) {
34867        openArray("jurisdiction");
34868        for (CodeableConcept e : element.getJurisdiction()) 
34869          composeCodeableConcept(null, e);
34870        closeArray();
34871      };
34872      if (element.hasUsageElement()) {
34873        composeStringCore("usage", element.getUsageElement(), false);
34874        composeStringExtras("usage", element.getUsageElement(), false);
34875      }
34876      if (element.hasUniqueId()) {
34877        openArray("uniqueId");
34878        for (NamingSystem.NamingSystemUniqueIdComponent e : element.getUniqueId()) 
34879          composeNamingSystemNamingSystemUniqueIdComponent(null, e);
34880        closeArray();
34881      };
34882      if (element.hasReplacedBy()) {
34883        composeReference("replacedBy", element.getReplacedBy());
34884      }
34885  }
34886
34887  protected void composeNamingSystemNamingSystemUniqueIdComponent(String name, NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
34888    if (element != null) {
34889      open(name);
34890      composeNamingSystemNamingSystemUniqueIdComponentInner(element);
34891      close();
34892    }
34893  }
34894
34895  protected void composeNamingSystemNamingSystemUniqueIdComponentInner(NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
34896      composeBackbone(element);
34897      if (element.hasTypeElement()) {
34898        composeEnumerationCore("type", element.getTypeElement(), new NamingSystem.NamingSystemIdentifierTypeEnumFactory(), false);
34899        composeEnumerationExtras("type", element.getTypeElement(), new NamingSystem.NamingSystemIdentifierTypeEnumFactory(), false);
34900      }
34901      if (element.hasValueElement()) {
34902        composeStringCore("value", element.getValueElement(), false);
34903        composeStringExtras("value", element.getValueElement(), false);
34904      }
34905      if (element.hasPreferredElement()) {
34906        composeBooleanCore("preferred", element.getPreferredElement(), false);
34907        composeBooleanExtras("preferred", element.getPreferredElement(), false);
34908      }
34909      if (element.hasCommentElement()) {
34910        composeStringCore("comment", element.getCommentElement(), false);
34911        composeStringExtras("comment", element.getCommentElement(), false);
34912      }
34913      if (element.hasPeriod()) {
34914        composePeriod("period", element.getPeriod());
34915      }
34916  }
34917
34918  protected void composeNutritionOrder(String name, NutritionOrder element) throws IOException {
34919    if (element != null) {
34920      prop("resourceType", name);
34921      composeNutritionOrderInner(element);
34922    }
34923  }
34924
34925  protected void composeNutritionOrderInner(NutritionOrder element) throws IOException {
34926      composeDomainResourceElements(element);
34927      if (element.hasIdentifier()) {
34928        openArray("identifier");
34929        for (Identifier e : element.getIdentifier()) 
34930          composeIdentifier(null, e);
34931        closeArray();
34932      };
34933      if (element.hasStatusElement()) {
34934        composeEnumerationCore("status", element.getStatusElement(), new NutritionOrder.NutritionOrderStatusEnumFactory(), false);
34935        composeEnumerationExtras("status", element.getStatusElement(), new NutritionOrder.NutritionOrderStatusEnumFactory(), false);
34936      }
34937      if (element.hasPatient()) {
34938        composeReference("patient", element.getPatient());
34939      }
34940      if (element.hasEncounter()) {
34941        composeReference("encounter", element.getEncounter());
34942      }
34943      if (element.hasDateTimeElement()) {
34944        composeDateTimeCore("dateTime", element.getDateTimeElement(), false);
34945        composeDateTimeExtras("dateTime", element.getDateTimeElement(), false);
34946      }
34947      if (element.hasOrderer()) {
34948        composeReference("orderer", element.getOrderer());
34949      }
34950      if (element.hasAllergyIntolerance()) {
34951        openArray("allergyIntolerance");
34952        for (Reference e : element.getAllergyIntolerance()) 
34953          composeReference(null, e);
34954        closeArray();
34955      };
34956      if (element.hasFoodPreferenceModifier()) {
34957        openArray("foodPreferenceModifier");
34958        for (CodeableConcept e : element.getFoodPreferenceModifier()) 
34959          composeCodeableConcept(null, e);
34960        closeArray();
34961      };
34962      if (element.hasExcludeFoodModifier()) {
34963        openArray("excludeFoodModifier");
34964        for (CodeableConcept e : element.getExcludeFoodModifier()) 
34965          composeCodeableConcept(null, e);
34966        closeArray();
34967      };
34968      if (element.hasOralDiet()) {
34969        composeNutritionOrderNutritionOrderOralDietComponent("oralDiet", element.getOralDiet());
34970      }
34971      if (element.hasSupplement()) {
34972        openArray("supplement");
34973        for (NutritionOrder.NutritionOrderSupplementComponent e : element.getSupplement()) 
34974          composeNutritionOrderNutritionOrderSupplementComponent(null, e);
34975        closeArray();
34976      };
34977      if (element.hasEnteralFormula()) {
34978        composeNutritionOrderNutritionOrderEnteralFormulaComponent("enteralFormula", element.getEnteralFormula());
34979      }
34980  }
34981
34982  protected void composeNutritionOrderNutritionOrderOralDietComponent(String name, NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
34983    if (element != null) {
34984      open(name);
34985      composeNutritionOrderNutritionOrderOralDietComponentInner(element);
34986      close();
34987    }
34988  }
34989
34990  protected void composeNutritionOrderNutritionOrderOralDietComponentInner(NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
34991      composeBackbone(element);
34992      if (element.hasType()) {
34993        openArray("type");
34994        for (CodeableConcept e : element.getType()) 
34995          composeCodeableConcept(null, e);
34996        closeArray();
34997      };
34998      if (element.hasSchedule()) {
34999        openArray("schedule");
35000        for (Timing e : element.getSchedule()) 
35001          composeTiming(null, e);
35002        closeArray();
35003      };
35004      if (element.hasNutrient()) {
35005        openArray("nutrient");
35006        for (NutritionOrder.NutritionOrderOralDietNutrientComponent e : element.getNutrient()) 
35007          composeNutritionOrderNutritionOrderOralDietNutrientComponent(null, e);
35008        closeArray();
35009      };
35010      if (element.hasTexture()) {
35011        openArray("texture");
35012        for (NutritionOrder.NutritionOrderOralDietTextureComponent e : element.getTexture()) 
35013          composeNutritionOrderNutritionOrderOralDietTextureComponent(null, e);
35014        closeArray();
35015      };
35016      if (element.hasFluidConsistencyType()) {
35017        openArray("fluidConsistencyType");
35018        for (CodeableConcept e : element.getFluidConsistencyType()) 
35019          composeCodeableConcept(null, e);
35020        closeArray();
35021      };
35022      if (element.hasInstructionElement()) {
35023        composeStringCore("instruction", element.getInstructionElement(), false);
35024        composeStringExtras("instruction", element.getInstructionElement(), false);
35025      }
35026  }
35027
35028  protected void composeNutritionOrderNutritionOrderOralDietNutrientComponent(String name, NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
35029    if (element != null) {
35030      open(name);
35031      composeNutritionOrderNutritionOrderOralDietNutrientComponentInner(element);
35032      close();
35033    }
35034  }
35035
35036  protected void composeNutritionOrderNutritionOrderOralDietNutrientComponentInner(NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
35037      composeBackbone(element);
35038      if (element.hasModifier()) {
35039        composeCodeableConcept("modifier", element.getModifier());
35040      }
35041      if (element.hasAmount()) {
35042        composeSimpleQuantity("amount", element.getAmount());
35043      }
35044  }
35045
35046  protected void composeNutritionOrderNutritionOrderOralDietTextureComponent(String name, NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
35047    if (element != null) {
35048      open(name);
35049      composeNutritionOrderNutritionOrderOralDietTextureComponentInner(element);
35050      close();
35051    }
35052  }
35053
35054  protected void composeNutritionOrderNutritionOrderOralDietTextureComponentInner(NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
35055      composeBackbone(element);
35056      if (element.hasModifier()) {
35057        composeCodeableConcept("modifier", element.getModifier());
35058      }
35059      if (element.hasFoodType()) {
35060        composeCodeableConcept("foodType", element.getFoodType());
35061      }
35062  }
35063
35064  protected void composeNutritionOrderNutritionOrderSupplementComponent(String name, NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
35065    if (element != null) {
35066      open(name);
35067      composeNutritionOrderNutritionOrderSupplementComponentInner(element);
35068      close();
35069    }
35070  }
35071
35072  protected void composeNutritionOrderNutritionOrderSupplementComponentInner(NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
35073      composeBackbone(element);
35074      if (element.hasType()) {
35075        composeCodeableConcept("type", element.getType());
35076      }
35077      if (element.hasProductNameElement()) {
35078        composeStringCore("productName", element.getProductNameElement(), false);
35079        composeStringExtras("productName", element.getProductNameElement(), false);
35080      }
35081      if (element.hasSchedule()) {
35082        openArray("schedule");
35083        for (Timing e : element.getSchedule()) 
35084          composeTiming(null, e);
35085        closeArray();
35086      };
35087      if (element.hasQuantity()) {
35088        composeSimpleQuantity("quantity", element.getQuantity());
35089      }
35090      if (element.hasInstructionElement()) {
35091        composeStringCore("instruction", element.getInstructionElement(), false);
35092        composeStringExtras("instruction", element.getInstructionElement(), false);
35093      }
35094  }
35095
35096  protected void composeNutritionOrderNutritionOrderEnteralFormulaComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
35097    if (element != null) {
35098      open(name);
35099      composeNutritionOrderNutritionOrderEnteralFormulaComponentInner(element);
35100      close();
35101    }
35102  }
35103
35104  protected void composeNutritionOrderNutritionOrderEnteralFormulaComponentInner(NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
35105      composeBackbone(element);
35106      if (element.hasBaseFormulaType()) {
35107        composeCodeableConcept("baseFormulaType", element.getBaseFormulaType());
35108      }
35109      if (element.hasBaseFormulaProductNameElement()) {
35110        composeStringCore("baseFormulaProductName", element.getBaseFormulaProductNameElement(), false);
35111        composeStringExtras("baseFormulaProductName", element.getBaseFormulaProductNameElement(), false);
35112      }
35113      if (element.hasAdditiveType()) {
35114        composeCodeableConcept("additiveType", element.getAdditiveType());
35115      }
35116      if (element.hasAdditiveProductNameElement()) {
35117        composeStringCore("additiveProductName", element.getAdditiveProductNameElement(), false);
35118        composeStringExtras("additiveProductName", element.getAdditiveProductNameElement(), false);
35119      }
35120      if (element.hasCaloricDensity()) {
35121        composeSimpleQuantity("caloricDensity", element.getCaloricDensity());
35122      }
35123      if (element.hasRouteofAdministration()) {
35124        composeCodeableConcept("routeofAdministration", element.getRouteofAdministration());
35125      }
35126      if (element.hasAdministration()) {
35127        openArray("administration");
35128        for (NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent e : element.getAdministration()) 
35129          composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(null, e);
35130        closeArray();
35131      };
35132      if (element.hasMaxVolumeToDeliver()) {
35133        composeSimpleQuantity("maxVolumeToDeliver", element.getMaxVolumeToDeliver());
35134      }
35135      if (element.hasAdministrationInstructionElement()) {
35136        composeStringCore("administrationInstruction", element.getAdministrationInstructionElement(), false);
35137        composeStringExtras("administrationInstruction", element.getAdministrationInstructionElement(), false);
35138      }
35139  }
35140
35141  protected void composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
35142    if (element != null) {
35143      open(name);
35144      composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentInner(element);
35145      close();
35146    }
35147  }
35148
35149  protected void composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentInner(NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
35150      composeBackbone(element);
35151      if (element.hasSchedule()) {
35152        composeTiming("schedule", element.getSchedule());
35153      }
35154      if (element.hasQuantity()) {
35155        composeSimpleQuantity("quantity", element.getQuantity());
35156      }
35157      if (element.hasRate()) {
35158        composeType("rate", element.getRate());
35159      }
35160  }
35161
35162  protected void composeObservation(String name, Observation element) throws IOException {
35163    if (element != null) {
35164      prop("resourceType", name);
35165      composeObservationInner(element);
35166    }
35167  }
35168
35169  protected void composeObservationInner(Observation element) throws IOException {
35170      composeDomainResourceElements(element);
35171      if (element.hasIdentifier()) {
35172        openArray("identifier");
35173        for (Identifier e : element.getIdentifier()) 
35174          composeIdentifier(null, e);
35175        closeArray();
35176      };
35177      if (element.hasBasedOn()) {
35178        openArray("basedOn");
35179        for (Reference e : element.getBasedOn()) 
35180          composeReference(null, e);
35181        closeArray();
35182      };
35183      if (element.hasStatusElement()) {
35184        composeEnumerationCore("status", element.getStatusElement(), new Observation.ObservationStatusEnumFactory(), false);
35185        composeEnumerationExtras("status", element.getStatusElement(), new Observation.ObservationStatusEnumFactory(), false);
35186      }
35187      if (element.hasCategory()) {
35188        openArray("category");
35189        for (CodeableConcept e : element.getCategory()) 
35190          composeCodeableConcept(null, e);
35191        closeArray();
35192      };
35193      if (element.hasCode()) {
35194        composeCodeableConcept("code", element.getCode());
35195      }
35196      if (element.hasSubject()) {
35197        composeReference("subject", element.getSubject());
35198      }
35199      if (element.hasContext()) {
35200        composeReference("context", element.getContext());
35201      }
35202      if (element.hasEffective()) {
35203        composeType("effective", element.getEffective());
35204      }
35205      if (element.hasIssuedElement()) {
35206        composeInstantCore("issued", element.getIssuedElement(), false);
35207        composeInstantExtras("issued", element.getIssuedElement(), false);
35208      }
35209      if (element.hasPerformer()) {
35210        openArray("performer");
35211        for (Reference e : element.getPerformer()) 
35212          composeReference(null, e);
35213        closeArray();
35214      };
35215      if (element.hasValue()) {
35216        composeType("value", element.getValue());
35217      }
35218      if (element.hasDataAbsentReason()) {
35219        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
35220      }
35221      if (element.hasInterpretation()) {
35222        composeCodeableConcept("interpretation", element.getInterpretation());
35223      }
35224      if (element.hasCommentElement()) {
35225        composeStringCore("comment", element.getCommentElement(), false);
35226        composeStringExtras("comment", element.getCommentElement(), false);
35227      }
35228      if (element.hasBodySite()) {
35229        composeCodeableConcept("bodySite", element.getBodySite());
35230      }
35231      if (element.hasMethod()) {
35232        composeCodeableConcept("method", element.getMethod());
35233      }
35234      if (element.hasSpecimen()) {
35235        composeReference("specimen", element.getSpecimen());
35236      }
35237      if (element.hasDevice()) {
35238        composeReference("device", element.getDevice());
35239      }
35240      if (element.hasReferenceRange()) {
35241        openArray("referenceRange");
35242        for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange()) 
35243          composeObservationObservationReferenceRangeComponent(null, e);
35244        closeArray();
35245      };
35246      if (element.hasRelated()) {
35247        openArray("related");
35248        for (Observation.ObservationRelatedComponent e : element.getRelated()) 
35249          composeObservationObservationRelatedComponent(null, e);
35250        closeArray();
35251      };
35252      if (element.hasComponent()) {
35253        openArray("component");
35254        for (Observation.ObservationComponentComponent e : element.getComponent()) 
35255          composeObservationObservationComponentComponent(null, e);
35256        closeArray();
35257      };
35258  }
35259
35260  protected void composeObservationObservationReferenceRangeComponent(String name, Observation.ObservationReferenceRangeComponent element) throws IOException {
35261    if (element != null) {
35262      open(name);
35263      composeObservationObservationReferenceRangeComponentInner(element);
35264      close();
35265    }
35266  }
35267
35268  protected void composeObservationObservationReferenceRangeComponentInner(Observation.ObservationReferenceRangeComponent element) throws IOException {
35269      composeBackbone(element);
35270      if (element.hasLow()) {
35271        composeSimpleQuantity("low", element.getLow());
35272      }
35273      if (element.hasHigh()) {
35274        composeSimpleQuantity("high", element.getHigh());
35275      }
35276      if (element.hasType()) {
35277        composeCodeableConcept("type", element.getType());
35278      }
35279      if (element.hasAppliesTo()) {
35280        openArray("appliesTo");
35281        for (CodeableConcept e : element.getAppliesTo()) 
35282          composeCodeableConcept(null, e);
35283        closeArray();
35284      };
35285      if (element.hasAge()) {
35286        composeRange("age", element.getAge());
35287      }
35288      if (element.hasTextElement()) {
35289        composeStringCore("text", element.getTextElement(), false);
35290        composeStringExtras("text", element.getTextElement(), false);
35291      }
35292  }
35293
35294  protected void composeObservationObservationRelatedComponent(String name, Observation.ObservationRelatedComponent element) throws IOException {
35295    if (element != null) {
35296      open(name);
35297      composeObservationObservationRelatedComponentInner(element);
35298      close();
35299    }
35300  }
35301
35302  protected void composeObservationObservationRelatedComponentInner(Observation.ObservationRelatedComponent element) throws IOException {
35303      composeBackbone(element);
35304      if (element.hasTypeElement()) {
35305        composeEnumerationCore("type", element.getTypeElement(), new Observation.ObservationRelationshipTypeEnumFactory(), false);
35306        composeEnumerationExtras("type", element.getTypeElement(), new Observation.ObservationRelationshipTypeEnumFactory(), false);
35307      }
35308      if (element.hasTarget()) {
35309        composeReference("target", element.getTarget());
35310      }
35311  }
35312
35313  protected void composeObservationObservationComponentComponent(String name, Observation.ObservationComponentComponent element) throws IOException {
35314    if (element != null) {
35315      open(name);
35316      composeObservationObservationComponentComponentInner(element);
35317      close();
35318    }
35319  }
35320
35321  protected void composeObservationObservationComponentComponentInner(Observation.ObservationComponentComponent element) throws IOException {
35322      composeBackbone(element);
35323      if (element.hasCode()) {
35324        composeCodeableConcept("code", element.getCode());
35325      }
35326      if (element.hasValue()) {
35327        composeType("value", element.getValue());
35328      }
35329      if (element.hasDataAbsentReason()) {
35330        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
35331      }
35332      if (element.hasInterpretation()) {
35333        composeCodeableConcept("interpretation", element.getInterpretation());
35334      }
35335      if (element.hasReferenceRange()) {
35336        openArray("referenceRange");
35337        for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange()) 
35338          composeObservationObservationReferenceRangeComponent(null, e);
35339        closeArray();
35340      };
35341  }
35342
35343  protected void composeOperationDefinition(String name, OperationDefinition element) throws IOException {
35344    if (element != null) {
35345      prop("resourceType", name);
35346      composeOperationDefinitionInner(element);
35347    }
35348  }
35349
35350  protected void composeOperationDefinitionInner(OperationDefinition element) throws IOException {
35351      composeDomainResourceElements(element);
35352      if (element.hasUrlElement()) {
35353        composeUriCore("url", element.getUrlElement(), false);
35354        composeUriExtras("url", element.getUrlElement(), false);
35355      }
35356      if (element.hasVersionElement()) {
35357        composeStringCore("version", element.getVersionElement(), false);
35358        composeStringExtras("version", element.getVersionElement(), false);
35359      }
35360      if (element.hasNameElement()) {
35361        composeStringCore("name", element.getNameElement(), false);
35362        composeStringExtras("name", element.getNameElement(), false);
35363      }
35364      if (element.hasStatusElement()) {
35365        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35366        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35367      }
35368      if (element.hasKindElement()) {
35369        composeEnumerationCore("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory(), false);
35370        composeEnumerationExtras("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory(), false);
35371      }
35372      if (element.hasExperimentalElement()) {
35373        composeBooleanCore("experimental", element.getExperimentalElement(), false);
35374        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
35375      }
35376      if (element.hasDateElement()) {
35377        composeDateTimeCore("date", element.getDateElement(), false);
35378        composeDateTimeExtras("date", element.getDateElement(), false);
35379      }
35380      if (element.hasPublisherElement()) {
35381        composeStringCore("publisher", element.getPublisherElement(), false);
35382        composeStringExtras("publisher", element.getPublisherElement(), false);
35383      }
35384      if (element.hasContact()) {
35385        openArray("contact");
35386        for (ContactDetail e : element.getContact()) 
35387          composeContactDetail(null, e);
35388        closeArray();
35389      };
35390      if (element.hasDescriptionElement()) {
35391        composeMarkdownCore("description", element.getDescriptionElement(), false);
35392        composeMarkdownExtras("description", element.getDescriptionElement(), false);
35393      }
35394      if (element.hasUseContext()) {
35395        openArray("useContext");
35396        for (UsageContext e : element.getUseContext()) 
35397          composeUsageContext(null, e);
35398        closeArray();
35399      };
35400      if (element.hasJurisdiction()) {
35401        openArray("jurisdiction");
35402        for (CodeableConcept e : element.getJurisdiction()) 
35403          composeCodeableConcept(null, e);
35404        closeArray();
35405      };
35406      if (element.hasPurposeElement()) {
35407        composeMarkdownCore("purpose", element.getPurposeElement(), false);
35408        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
35409      }
35410      if (element.hasIdempotentElement()) {
35411        composeBooleanCore("idempotent", element.getIdempotentElement(), false);
35412        composeBooleanExtras("idempotent", element.getIdempotentElement(), false);
35413      }
35414      if (element.hasCodeElement()) {
35415        composeCodeCore("code", element.getCodeElement(), false);
35416        composeCodeExtras("code", element.getCodeElement(), false);
35417      }
35418      if (element.hasCommentElement()) {
35419        composeStringCore("comment", element.getCommentElement(), false);
35420        composeStringExtras("comment", element.getCommentElement(), false);
35421      }
35422      if (element.hasBase()) {
35423        composeReference("base", element.getBase());
35424      }
35425      if (element.hasResource()) {
35426        openArray("resource");
35427        for (CodeType e : element.getResource()) 
35428          composeCodeCore(null, e, true);
35429        closeArray();
35430        if (anyHasExtras(element.getResource())) {
35431          openArray("_resource");
35432          for (CodeType e : element.getResource()) 
35433            composeCodeExtras(null, e, true);
35434          closeArray();
35435        }
35436      };
35437      if (element.hasSystemElement()) {
35438        composeBooleanCore("system", element.getSystemElement(), false);
35439        composeBooleanExtras("system", element.getSystemElement(), false);
35440      }
35441      if (element.hasTypeElement()) {
35442        composeBooleanCore("type", element.getTypeElement(), false);
35443        composeBooleanExtras("type", element.getTypeElement(), false);
35444      }
35445      if (element.hasInstanceElement()) {
35446        composeBooleanCore("instance", element.getInstanceElement(), false);
35447        composeBooleanExtras("instance", element.getInstanceElement(), false);
35448      }
35449      if (element.hasParameter()) {
35450        openArray("parameter");
35451        for (OperationDefinition.OperationDefinitionParameterComponent e : element.getParameter()) 
35452          composeOperationDefinitionOperationDefinitionParameterComponent(null, e);
35453        closeArray();
35454      };
35455      if (element.hasOverload()) {
35456        openArray("overload");
35457        for (OperationDefinition.OperationDefinitionOverloadComponent e : element.getOverload()) 
35458          composeOperationDefinitionOperationDefinitionOverloadComponent(null, e);
35459        closeArray();
35460      };
35461  }
35462
35463  protected void composeOperationDefinitionOperationDefinitionParameterComponent(String name, OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
35464    if (element != null) {
35465      open(name);
35466      composeOperationDefinitionOperationDefinitionParameterComponentInner(element);
35467      close();
35468    }
35469  }
35470
35471  protected void composeOperationDefinitionOperationDefinitionParameterComponentInner(OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
35472      composeBackbone(element);
35473      if (element.hasNameElement()) {
35474        composeCodeCore("name", element.getNameElement(), false);
35475        composeCodeExtras("name", element.getNameElement(), false);
35476      }
35477      if (element.hasUseElement()) {
35478        composeEnumerationCore("use", element.getUseElement(), new OperationDefinition.OperationParameterUseEnumFactory(), false);
35479        composeEnumerationExtras("use", element.getUseElement(), new OperationDefinition.OperationParameterUseEnumFactory(), false);
35480      }
35481      if (element.hasMinElement()) {
35482        composeIntegerCore("min", element.getMinElement(), false);
35483        composeIntegerExtras("min", element.getMinElement(), false);
35484      }
35485      if (element.hasMaxElement()) {
35486        composeStringCore("max", element.getMaxElement(), false);
35487        composeStringExtras("max", element.getMaxElement(), false);
35488      }
35489      if (element.hasDocumentationElement()) {
35490        composeStringCore("documentation", element.getDocumentationElement(), false);
35491        composeStringExtras("documentation", element.getDocumentationElement(), false);
35492      }
35493      if (element.hasTypeElement()) {
35494        composeCodeCore("type", element.getTypeElement(), false);
35495        composeCodeExtras("type", element.getTypeElement(), false);
35496      }
35497      if (element.hasSearchTypeElement()) {
35498        composeEnumerationCore("searchType", element.getSearchTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
35499        composeEnumerationExtras("searchType", element.getSearchTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
35500      }
35501      if (element.hasProfile()) {
35502        composeReference("profile", element.getProfile());
35503      }
35504      if (element.hasBinding()) {
35505        composeOperationDefinitionOperationDefinitionParameterBindingComponent("binding", element.getBinding());
35506      }
35507      if (element.hasPart()) {
35508        openArray("part");
35509        for (OperationDefinition.OperationDefinitionParameterComponent e : element.getPart()) 
35510          composeOperationDefinitionOperationDefinitionParameterComponent(null, e);
35511        closeArray();
35512      };
35513  }
35514
35515  protected void composeOperationDefinitionOperationDefinitionParameterBindingComponent(String name, OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
35516    if (element != null) {
35517      open(name);
35518      composeOperationDefinitionOperationDefinitionParameterBindingComponentInner(element);
35519      close();
35520    }
35521  }
35522
35523  protected void composeOperationDefinitionOperationDefinitionParameterBindingComponentInner(OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
35524      composeBackbone(element);
35525      if (element.hasStrengthElement()) {
35526        composeEnumerationCore("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
35527        composeEnumerationExtras("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
35528      }
35529      if (element.hasValueSet()) {
35530        composeType("valueSet", element.getValueSet());
35531      }
35532  }
35533
35534  protected void composeOperationDefinitionOperationDefinitionOverloadComponent(String name, OperationDefinition.OperationDefinitionOverloadComponent element) throws IOException {
35535    if (element != null) {
35536      open(name);
35537      composeOperationDefinitionOperationDefinitionOverloadComponentInner(element);
35538      close();
35539    }
35540  }
35541
35542  protected void composeOperationDefinitionOperationDefinitionOverloadComponentInner(OperationDefinition.OperationDefinitionOverloadComponent element) throws IOException {
35543      composeBackbone(element);
35544      if (element.hasParameterName()) {
35545        openArray("parameterName");
35546        for (StringType e : element.getParameterName()) 
35547          composeStringCore(null, e, true);
35548        closeArray();
35549        if (anyHasExtras(element.getParameterName())) {
35550          openArray("_parameterName");
35551          for (StringType e : element.getParameterName()) 
35552            composeStringExtras(null, e, true);
35553          closeArray();
35554        }
35555      };
35556      if (element.hasCommentElement()) {
35557        composeStringCore("comment", element.getCommentElement(), false);
35558        composeStringExtras("comment", element.getCommentElement(), false);
35559      }
35560  }
35561
35562  protected void composeOperationOutcome(String name, OperationOutcome element) throws IOException {
35563    if (element != null) {
35564      prop("resourceType", name);
35565      composeOperationOutcomeInner(element);
35566    }
35567  }
35568
35569  protected void composeOperationOutcomeInner(OperationOutcome element) throws IOException {
35570      composeDomainResourceElements(element);
35571      if (element.hasIssue()) {
35572        openArray("issue");
35573        for (OperationOutcome.OperationOutcomeIssueComponent e : element.getIssue()) 
35574          composeOperationOutcomeOperationOutcomeIssueComponent(null, e);
35575        closeArray();
35576      };
35577  }
35578
35579  protected void composeOperationOutcomeOperationOutcomeIssueComponent(String name, OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
35580    if (element != null) {
35581      open(name);
35582      composeOperationOutcomeOperationOutcomeIssueComponentInner(element);
35583      close();
35584    }
35585  }
35586
35587  protected void composeOperationOutcomeOperationOutcomeIssueComponentInner(OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
35588      composeBackbone(element);
35589      if (element.hasSeverityElement()) {
35590        composeEnumerationCore("severity", element.getSeverityElement(), new OperationOutcome.IssueSeverityEnumFactory(), false);
35591        composeEnumerationExtras("severity", element.getSeverityElement(), new OperationOutcome.IssueSeverityEnumFactory(), false);
35592      }
35593      if (element.hasCodeElement()) {
35594        composeEnumerationCore("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory(), false);
35595        composeEnumerationExtras("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory(), false);
35596      }
35597      if (element.hasDetails()) {
35598        composeCodeableConcept("details", element.getDetails());
35599      }
35600      if (element.hasDiagnosticsElement()) {
35601        composeStringCore("diagnostics", element.getDiagnosticsElement(), false);
35602        composeStringExtras("diagnostics", element.getDiagnosticsElement(), false);
35603      }
35604      if (element.hasLocation()) {
35605        openArray("location");
35606        for (StringType e : element.getLocation()) 
35607          composeStringCore(null, e, true);
35608        closeArray();
35609        if (anyHasExtras(element.getLocation())) {
35610          openArray("_location");
35611          for (StringType e : element.getLocation()) 
35612            composeStringExtras(null, e, true);
35613          closeArray();
35614        }
35615      };
35616      if (element.hasExpression()) {
35617        openArray("expression");
35618        for (StringType e : element.getExpression()) 
35619          composeStringCore(null, e, true);
35620        closeArray();
35621        if (anyHasExtras(element.getExpression())) {
35622          openArray("_expression");
35623          for (StringType e : element.getExpression()) 
35624            composeStringExtras(null, e, true);
35625          closeArray();
35626        }
35627      };
35628  }
35629
35630  protected void composeOrganization(String name, Organization element) throws IOException {
35631    if (element != null) {
35632      prop("resourceType", name);
35633      composeOrganizationInner(element);
35634    }
35635  }
35636
35637  protected void composeOrganizationInner(Organization element) throws IOException {
35638      composeDomainResourceElements(element);
35639      if (element.hasIdentifier()) {
35640        openArray("identifier");
35641        for (Identifier e : element.getIdentifier()) 
35642          composeIdentifier(null, e);
35643        closeArray();
35644      };
35645      if (element.hasActiveElement()) {
35646        composeBooleanCore("active", element.getActiveElement(), false);
35647        composeBooleanExtras("active", element.getActiveElement(), false);
35648      }
35649      if (element.hasType()) {
35650        openArray("type");
35651        for (CodeableConcept e : element.getType()) 
35652          composeCodeableConcept(null, e);
35653        closeArray();
35654      };
35655      if (element.hasNameElement()) {
35656        composeStringCore("name", element.getNameElement(), false);
35657        composeStringExtras("name", element.getNameElement(), false);
35658      }
35659      if (element.hasAlias()) {
35660        openArray("alias");
35661        for (StringType e : element.getAlias()) 
35662          composeStringCore(null, e, true);
35663        closeArray();
35664        if (anyHasExtras(element.getAlias())) {
35665          openArray("_alias");
35666          for (StringType e : element.getAlias()) 
35667            composeStringExtras(null, e, true);
35668          closeArray();
35669        }
35670      };
35671      if (element.hasTelecom()) {
35672        openArray("telecom");
35673        for (ContactPoint e : element.getTelecom()) 
35674          composeContactPoint(null, e);
35675        closeArray();
35676      };
35677      if (element.hasAddress()) {
35678        openArray("address");
35679        for (Address e : element.getAddress()) 
35680          composeAddress(null, e);
35681        closeArray();
35682      };
35683      if (element.hasPartOf()) {
35684        composeReference("partOf", element.getPartOf());
35685      }
35686      if (element.hasContact()) {
35687        openArray("contact");
35688        for (Organization.OrganizationContactComponent e : element.getContact()) 
35689          composeOrganizationOrganizationContactComponent(null, e);
35690        closeArray();
35691      };
35692      if (element.hasEndpoint()) {
35693        openArray("endpoint");
35694        for (Reference e : element.getEndpoint()) 
35695          composeReference(null, e);
35696        closeArray();
35697      };
35698  }
35699
35700  protected void composeOrganizationOrganizationContactComponent(String name, Organization.OrganizationContactComponent element) throws IOException {
35701    if (element != null) {
35702      open(name);
35703      composeOrganizationOrganizationContactComponentInner(element);
35704      close();
35705    }
35706  }
35707
35708  protected void composeOrganizationOrganizationContactComponentInner(Organization.OrganizationContactComponent element) throws IOException {
35709      composeBackbone(element);
35710      if (element.hasPurpose()) {
35711        composeCodeableConcept("purpose", element.getPurpose());
35712      }
35713      if (element.hasName()) {
35714        composeHumanName("name", element.getName());
35715      }
35716      if (element.hasTelecom()) {
35717        openArray("telecom");
35718        for (ContactPoint e : element.getTelecom()) 
35719          composeContactPoint(null, e);
35720        closeArray();
35721      };
35722      if (element.hasAddress()) {
35723        composeAddress("address", element.getAddress());
35724      }
35725  }
35726
35727  protected void composePatient(String name, Patient element) throws IOException {
35728    if (element != null) {
35729      prop("resourceType", name);
35730      composePatientInner(element);
35731    }
35732  }
35733
35734  protected void composePatientInner(Patient element) throws IOException {
35735      composeDomainResourceElements(element);
35736      if (element.hasIdentifier()) {
35737        openArray("identifier");
35738        for (Identifier e : element.getIdentifier()) 
35739          composeIdentifier(null, e);
35740        closeArray();
35741      };
35742      if (element.hasActiveElement()) {
35743        composeBooleanCore("active", element.getActiveElement(), false);
35744        composeBooleanExtras("active", element.getActiveElement(), false);
35745      }
35746      if (element.hasName()) {
35747        openArray("name");
35748        for (HumanName e : element.getName()) 
35749          composeHumanName(null, e);
35750        closeArray();
35751      };
35752      if (element.hasTelecom()) {
35753        openArray("telecom");
35754        for (ContactPoint e : element.getTelecom()) 
35755          composeContactPoint(null, e);
35756        closeArray();
35757      };
35758      if (element.hasGenderElement()) {
35759        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
35760        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
35761      }
35762      if (element.hasBirthDateElement()) {
35763        composeDateCore("birthDate", element.getBirthDateElement(), false);
35764        composeDateExtras("birthDate", element.getBirthDateElement(), false);
35765      }
35766      if (element.hasDeceased()) {
35767        composeType("deceased", element.getDeceased());
35768      }
35769      if (element.hasAddress()) {
35770        openArray("address");
35771        for (Address e : element.getAddress()) 
35772          composeAddress(null, e);
35773        closeArray();
35774      };
35775      if (element.hasMaritalStatus()) {
35776        composeCodeableConcept("maritalStatus", element.getMaritalStatus());
35777      }
35778      if (element.hasMultipleBirth()) {
35779        composeType("multipleBirth", element.getMultipleBirth());
35780      }
35781      if (element.hasPhoto()) {
35782        openArray("photo");
35783        for (Attachment e : element.getPhoto()) 
35784          composeAttachment(null, e);
35785        closeArray();
35786      };
35787      if (element.hasContact()) {
35788        openArray("contact");
35789        for (Patient.ContactComponent e : element.getContact()) 
35790          composePatientContactComponent(null, e);
35791        closeArray();
35792      };
35793      if (element.hasAnimal()) {
35794        composePatientAnimalComponent("animal", element.getAnimal());
35795      }
35796      if (element.hasCommunication()) {
35797        openArray("communication");
35798        for (Patient.PatientCommunicationComponent e : element.getCommunication()) 
35799          composePatientPatientCommunicationComponent(null, e);
35800        closeArray();
35801      };
35802      if (element.hasGeneralPractitioner()) {
35803        openArray("generalPractitioner");
35804        for (Reference e : element.getGeneralPractitioner()) 
35805          composeReference(null, e);
35806        closeArray();
35807      };
35808      if (element.hasManagingOrganization()) {
35809        composeReference("managingOrganization", element.getManagingOrganization());
35810      }
35811      if (element.hasLink()) {
35812        openArray("link");
35813        for (Patient.PatientLinkComponent e : element.getLink()) 
35814          composePatientPatientLinkComponent(null, e);
35815        closeArray();
35816      };
35817  }
35818
35819  protected void composePatientContactComponent(String name, Patient.ContactComponent element) throws IOException {
35820    if (element != null) {
35821      open(name);
35822      composePatientContactComponentInner(element);
35823      close();
35824    }
35825  }
35826
35827  protected void composePatientContactComponentInner(Patient.ContactComponent element) throws IOException {
35828      composeBackbone(element);
35829      if (element.hasRelationship()) {
35830        openArray("relationship");
35831        for (CodeableConcept e : element.getRelationship()) 
35832          composeCodeableConcept(null, e);
35833        closeArray();
35834      };
35835      if (element.hasName()) {
35836        composeHumanName("name", element.getName());
35837      }
35838      if (element.hasTelecom()) {
35839        openArray("telecom");
35840        for (ContactPoint e : element.getTelecom()) 
35841          composeContactPoint(null, e);
35842        closeArray();
35843      };
35844      if (element.hasAddress()) {
35845        composeAddress("address", element.getAddress());
35846      }
35847      if (element.hasGenderElement()) {
35848        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
35849        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
35850      }
35851      if (element.hasOrganization()) {
35852        composeReference("organization", element.getOrganization());
35853      }
35854      if (element.hasPeriod()) {
35855        composePeriod("period", element.getPeriod());
35856      }
35857  }
35858
35859  protected void composePatientAnimalComponent(String name, Patient.AnimalComponent element) throws IOException {
35860    if (element != null) {
35861      open(name);
35862      composePatientAnimalComponentInner(element);
35863      close();
35864    }
35865  }
35866
35867  protected void composePatientAnimalComponentInner(Patient.AnimalComponent element) throws IOException {
35868      composeBackbone(element);
35869      if (element.hasSpecies()) {
35870        composeCodeableConcept("species", element.getSpecies());
35871      }
35872      if (element.hasBreed()) {
35873        composeCodeableConcept("breed", element.getBreed());
35874      }
35875      if (element.hasGenderStatus()) {
35876        composeCodeableConcept("genderStatus", element.getGenderStatus());
35877      }
35878  }
35879
35880  protected void composePatientPatientCommunicationComponent(String name, Patient.PatientCommunicationComponent element) throws IOException {
35881    if (element != null) {
35882      open(name);
35883      composePatientPatientCommunicationComponentInner(element);
35884      close();
35885    }
35886  }
35887
35888  protected void composePatientPatientCommunicationComponentInner(Patient.PatientCommunicationComponent element) throws IOException {
35889      composeBackbone(element);
35890      if (element.hasLanguage()) {
35891        composeCodeableConcept("language", element.getLanguage());
35892      }
35893      if (element.hasPreferredElement()) {
35894        composeBooleanCore("preferred", element.getPreferredElement(), false);
35895        composeBooleanExtras("preferred", element.getPreferredElement(), false);
35896      }
35897  }
35898
35899  protected void composePatientPatientLinkComponent(String name, Patient.PatientLinkComponent element) throws IOException {
35900    if (element != null) {
35901      open(name);
35902      composePatientPatientLinkComponentInner(element);
35903      close();
35904    }
35905  }
35906
35907  protected void composePatientPatientLinkComponentInner(Patient.PatientLinkComponent element) throws IOException {
35908      composeBackbone(element);
35909      if (element.hasOther()) {
35910        composeReference("other", element.getOther());
35911      }
35912      if (element.hasTypeElement()) {
35913        composeEnumerationCore("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory(), false);
35914        composeEnumerationExtras("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory(), false);
35915      }
35916  }
35917
35918  protected void composePaymentNotice(String name, PaymentNotice element) throws IOException {
35919    if (element != null) {
35920      prop("resourceType", name);
35921      composePaymentNoticeInner(element);
35922    }
35923  }
35924
35925  protected void composePaymentNoticeInner(PaymentNotice element) throws IOException {
35926      composeDomainResourceElements(element);
35927      if (element.hasIdentifier()) {
35928        openArray("identifier");
35929        for (Identifier e : element.getIdentifier()) 
35930          composeIdentifier(null, e);
35931        closeArray();
35932      };
35933      if (element.hasStatusElement()) {
35934        composeEnumerationCore("status", element.getStatusElement(), new PaymentNotice.PaymentNoticeStatusEnumFactory(), false);
35935        composeEnumerationExtras("status", element.getStatusElement(), new PaymentNotice.PaymentNoticeStatusEnumFactory(), false);
35936      }
35937      if (element.hasRequest()) {
35938        composeReference("request", element.getRequest());
35939      }
35940      if (element.hasResponse()) {
35941        composeReference("response", element.getResponse());
35942      }
35943      if (element.hasStatusDateElement()) {
35944        composeDateCore("statusDate", element.getStatusDateElement(), false);
35945        composeDateExtras("statusDate", element.getStatusDateElement(), false);
35946      }
35947      if (element.hasCreatedElement()) {
35948        composeDateTimeCore("created", element.getCreatedElement(), false);
35949        composeDateTimeExtras("created", element.getCreatedElement(), false);
35950      }
35951      if (element.hasTarget()) {
35952        composeReference("target", element.getTarget());
35953      }
35954      if (element.hasProvider()) {
35955        composeReference("provider", element.getProvider());
35956      }
35957      if (element.hasOrganization()) {
35958        composeReference("organization", element.getOrganization());
35959      }
35960      if (element.hasPaymentStatus()) {
35961        composeCodeableConcept("paymentStatus", element.getPaymentStatus());
35962      }
35963  }
35964
35965  protected void composePaymentReconciliation(String name, PaymentReconciliation element) throws IOException {
35966    if (element != null) {
35967      prop("resourceType", name);
35968      composePaymentReconciliationInner(element);
35969    }
35970  }
35971
35972  protected void composePaymentReconciliationInner(PaymentReconciliation element) throws IOException {
35973      composeDomainResourceElements(element);
35974      if (element.hasIdentifier()) {
35975        openArray("identifier");
35976        for (Identifier e : element.getIdentifier()) 
35977          composeIdentifier(null, e);
35978        closeArray();
35979      };
35980      if (element.hasStatusElement()) {
35981        composeEnumerationCore("status", element.getStatusElement(), new PaymentReconciliation.PaymentReconciliationStatusEnumFactory(), false);
35982        composeEnumerationExtras("status", element.getStatusElement(), new PaymentReconciliation.PaymentReconciliationStatusEnumFactory(), false);
35983      }
35984      if (element.hasPeriod()) {
35985        composePeriod("period", element.getPeriod());
35986      }
35987      if (element.hasCreatedElement()) {
35988        composeDateTimeCore("created", element.getCreatedElement(), false);
35989        composeDateTimeExtras("created", element.getCreatedElement(), false);
35990      }
35991      if (element.hasOrganization()) {
35992        composeReference("organization", element.getOrganization());
35993      }
35994      if (element.hasRequest()) {
35995        composeReference("request", element.getRequest());
35996      }
35997      if (element.hasOutcome()) {
35998        composeCodeableConcept("outcome", element.getOutcome());
35999      }
36000      if (element.hasDispositionElement()) {
36001        composeStringCore("disposition", element.getDispositionElement(), false);
36002        composeStringExtras("disposition", element.getDispositionElement(), false);
36003      }
36004      if (element.hasRequestProvider()) {
36005        composeReference("requestProvider", element.getRequestProvider());
36006      }
36007      if (element.hasRequestOrganization()) {
36008        composeReference("requestOrganization", element.getRequestOrganization());
36009      }
36010      if (element.hasDetail()) {
36011        openArray("detail");
36012        for (PaymentReconciliation.DetailsComponent e : element.getDetail()) 
36013          composePaymentReconciliationDetailsComponent(null, e);
36014        closeArray();
36015      };
36016      if (element.hasForm()) {
36017        composeCodeableConcept("form", element.getForm());
36018      }
36019      if (element.hasTotal()) {
36020        composeMoney("total", element.getTotal());
36021      }
36022      if (element.hasProcessNote()) {
36023        openArray("processNote");
36024        for (PaymentReconciliation.NotesComponent e : element.getProcessNote()) 
36025          composePaymentReconciliationNotesComponent(null, e);
36026        closeArray();
36027      };
36028  }
36029
36030  protected void composePaymentReconciliationDetailsComponent(String name, PaymentReconciliation.DetailsComponent element) throws IOException {
36031    if (element != null) {
36032      open(name);
36033      composePaymentReconciliationDetailsComponentInner(element);
36034      close();
36035    }
36036  }
36037
36038  protected void composePaymentReconciliationDetailsComponentInner(PaymentReconciliation.DetailsComponent element) throws IOException {
36039      composeBackbone(element);
36040      if (element.hasType()) {
36041        composeCodeableConcept("type", element.getType());
36042      }
36043      if (element.hasRequest()) {
36044        composeReference("request", element.getRequest());
36045      }
36046      if (element.hasResponse()) {
36047        composeReference("response", element.getResponse());
36048      }
36049      if (element.hasSubmitter()) {
36050        composeReference("submitter", element.getSubmitter());
36051      }
36052      if (element.hasPayee()) {
36053        composeReference("payee", element.getPayee());
36054      }
36055      if (element.hasDateElement()) {
36056        composeDateCore("date", element.getDateElement(), false);
36057        composeDateExtras("date", element.getDateElement(), false);
36058      }
36059      if (element.hasAmount()) {
36060        composeMoney("amount", element.getAmount());
36061      }
36062  }
36063
36064  protected void composePaymentReconciliationNotesComponent(String name, PaymentReconciliation.NotesComponent element) throws IOException {
36065    if (element != null) {
36066      open(name);
36067      composePaymentReconciliationNotesComponentInner(element);
36068      close();
36069    }
36070  }
36071
36072  protected void composePaymentReconciliationNotesComponentInner(PaymentReconciliation.NotesComponent element) throws IOException {
36073      composeBackbone(element);
36074      if (element.hasType()) {
36075        composeCodeableConcept("type", element.getType());
36076      }
36077      if (element.hasTextElement()) {
36078        composeStringCore("text", element.getTextElement(), false);
36079        composeStringExtras("text", element.getTextElement(), false);
36080      }
36081  }
36082
36083  protected void composePerson(String name, Person element) throws IOException {
36084    if (element != null) {
36085      prop("resourceType", name);
36086      composePersonInner(element);
36087    }
36088  }
36089
36090  protected void composePersonInner(Person element) throws IOException {
36091      composeDomainResourceElements(element);
36092      if (element.hasIdentifier()) {
36093        openArray("identifier");
36094        for (Identifier e : element.getIdentifier()) 
36095          composeIdentifier(null, e);
36096        closeArray();
36097      };
36098      if (element.hasName()) {
36099        openArray("name");
36100        for (HumanName e : element.getName()) 
36101          composeHumanName(null, e);
36102        closeArray();
36103      };
36104      if (element.hasTelecom()) {
36105        openArray("telecom");
36106        for (ContactPoint e : element.getTelecom()) 
36107          composeContactPoint(null, e);
36108        closeArray();
36109      };
36110      if (element.hasGenderElement()) {
36111        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
36112        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
36113      }
36114      if (element.hasBirthDateElement()) {
36115        composeDateCore("birthDate", element.getBirthDateElement(), false);
36116        composeDateExtras("birthDate", element.getBirthDateElement(), false);
36117      }
36118      if (element.hasAddress()) {
36119        openArray("address");
36120        for (Address e : element.getAddress()) 
36121          composeAddress(null, e);
36122        closeArray();
36123      };
36124      if (element.hasPhoto()) {
36125        composeAttachment("photo", element.getPhoto());
36126      }
36127      if (element.hasManagingOrganization()) {
36128        composeReference("managingOrganization", element.getManagingOrganization());
36129      }
36130      if (element.hasActiveElement()) {
36131        composeBooleanCore("active", element.getActiveElement(), false);
36132        composeBooleanExtras("active", element.getActiveElement(), false);
36133      }
36134      if (element.hasLink()) {
36135        openArray("link");
36136        for (Person.PersonLinkComponent e : element.getLink()) 
36137          composePersonPersonLinkComponent(null, e);
36138        closeArray();
36139      };
36140  }
36141
36142  protected void composePersonPersonLinkComponent(String name, Person.PersonLinkComponent element) throws IOException {
36143    if (element != null) {
36144      open(name);
36145      composePersonPersonLinkComponentInner(element);
36146      close();
36147    }
36148  }
36149
36150  protected void composePersonPersonLinkComponentInner(Person.PersonLinkComponent element) throws IOException {
36151      composeBackbone(element);
36152      if (element.hasTarget()) {
36153        composeReference("target", element.getTarget());
36154      }
36155      if (element.hasAssuranceElement()) {
36156        composeEnumerationCore("assurance", element.getAssuranceElement(), new Person.IdentityAssuranceLevelEnumFactory(), false);
36157        composeEnumerationExtras("assurance", element.getAssuranceElement(), new Person.IdentityAssuranceLevelEnumFactory(), false);
36158      }
36159  }
36160
36161  protected void composePlanDefinition(String name, PlanDefinition element) throws IOException {
36162    if (element != null) {
36163      prop("resourceType", name);
36164      composePlanDefinitionInner(element);
36165    }
36166  }
36167
36168  protected void composePlanDefinitionInner(PlanDefinition element) throws IOException {
36169      composeDomainResourceElements(element);
36170      if (element.hasUrlElement()) {
36171        composeUriCore("url", element.getUrlElement(), false);
36172        composeUriExtras("url", element.getUrlElement(), false);
36173      }
36174      if (element.hasIdentifier()) {
36175        openArray("identifier");
36176        for (Identifier e : element.getIdentifier()) 
36177          composeIdentifier(null, e);
36178        closeArray();
36179      };
36180      if (element.hasVersionElement()) {
36181        composeStringCore("version", element.getVersionElement(), false);
36182        composeStringExtras("version", element.getVersionElement(), false);
36183      }
36184      if (element.hasNameElement()) {
36185        composeStringCore("name", element.getNameElement(), false);
36186        composeStringExtras("name", element.getNameElement(), false);
36187      }
36188      if (element.hasTitleElement()) {
36189        composeStringCore("title", element.getTitleElement(), false);
36190        composeStringExtras("title", element.getTitleElement(), false);
36191      }
36192      if (element.hasType()) {
36193        composeCodeableConcept("type", element.getType());
36194      }
36195      if (element.hasStatusElement()) {
36196        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
36197        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
36198      }
36199      if (element.hasExperimentalElement()) {
36200        composeBooleanCore("experimental", element.getExperimentalElement(), false);
36201        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
36202      }
36203      if (element.hasDateElement()) {
36204        composeDateTimeCore("date", element.getDateElement(), false);
36205        composeDateTimeExtras("date", element.getDateElement(), false);
36206      }
36207      if (element.hasPublisherElement()) {
36208        composeStringCore("publisher", element.getPublisherElement(), false);
36209        composeStringExtras("publisher", element.getPublisherElement(), false);
36210      }
36211      if (element.hasDescriptionElement()) {
36212        composeMarkdownCore("description", element.getDescriptionElement(), false);
36213        composeMarkdownExtras("description", element.getDescriptionElement(), false);
36214      }
36215      if (element.hasPurposeElement()) {
36216        composeMarkdownCore("purpose", element.getPurposeElement(), false);
36217        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
36218      }
36219      if (element.hasUsageElement()) {
36220        composeStringCore("usage", element.getUsageElement(), false);
36221        composeStringExtras("usage", element.getUsageElement(), false);
36222      }
36223      if (element.hasApprovalDateElement()) {
36224        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
36225        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
36226      }
36227      if (element.hasLastReviewDateElement()) {
36228        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
36229        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
36230      }
36231      if (element.hasEffectivePeriod()) {
36232        composePeriod("effectivePeriod", element.getEffectivePeriod());
36233      }
36234      if (element.hasUseContext()) {
36235        openArray("useContext");
36236        for (UsageContext e : element.getUseContext()) 
36237          composeUsageContext(null, e);
36238        closeArray();
36239      };
36240      if (element.hasJurisdiction()) {
36241        openArray("jurisdiction");
36242        for (CodeableConcept e : element.getJurisdiction()) 
36243          composeCodeableConcept(null, e);
36244        closeArray();
36245      };
36246      if (element.hasTopic()) {
36247        openArray("topic");
36248        for (CodeableConcept e : element.getTopic()) 
36249          composeCodeableConcept(null, e);
36250        closeArray();
36251      };
36252      if (element.hasContributor()) {
36253        openArray("contributor");
36254        for (Contributor e : element.getContributor()) 
36255          composeContributor(null, e);
36256        closeArray();
36257      };
36258      if (element.hasContact()) {
36259        openArray("contact");
36260        for (ContactDetail e : element.getContact()) 
36261          composeContactDetail(null, e);
36262        closeArray();
36263      };
36264      if (element.hasCopyrightElement()) {
36265        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
36266        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
36267      }
36268      if (element.hasRelatedArtifact()) {
36269        openArray("relatedArtifact");
36270        for (RelatedArtifact e : element.getRelatedArtifact()) 
36271          composeRelatedArtifact(null, e);
36272        closeArray();
36273      };
36274      if (element.hasLibrary()) {
36275        openArray("library");
36276        for (Reference e : element.getLibrary()) 
36277          composeReference(null, e);
36278        closeArray();
36279      };
36280      if (element.hasGoal()) {
36281        openArray("goal");
36282        for (PlanDefinition.PlanDefinitionGoalComponent e : element.getGoal()) 
36283          composePlanDefinitionPlanDefinitionGoalComponent(null, e);
36284        closeArray();
36285      };
36286      if (element.hasAction()) {
36287        openArray("action");
36288        for (PlanDefinition.PlanDefinitionActionComponent e : element.getAction()) 
36289          composePlanDefinitionPlanDefinitionActionComponent(null, e);
36290        closeArray();
36291      };
36292  }
36293
36294  protected void composePlanDefinitionPlanDefinitionGoalComponent(String name, PlanDefinition.PlanDefinitionGoalComponent element) throws IOException {
36295    if (element != null) {
36296      open(name);
36297      composePlanDefinitionPlanDefinitionGoalComponentInner(element);
36298      close();
36299    }
36300  }
36301
36302  protected void composePlanDefinitionPlanDefinitionGoalComponentInner(PlanDefinition.PlanDefinitionGoalComponent element) throws IOException {
36303      composeBackbone(element);
36304      if (element.hasCategory()) {
36305        composeCodeableConcept("category", element.getCategory());
36306      }
36307      if (element.hasDescription()) {
36308        composeCodeableConcept("description", element.getDescription());
36309      }
36310      if (element.hasPriority()) {
36311        composeCodeableConcept("priority", element.getPriority());
36312      }
36313      if (element.hasStart()) {
36314        composeCodeableConcept("start", element.getStart());
36315      }
36316      if (element.hasAddresses()) {
36317        openArray("addresses");
36318        for (CodeableConcept e : element.getAddresses()) 
36319          composeCodeableConcept(null, e);
36320        closeArray();
36321      };
36322      if (element.hasDocumentation()) {
36323        openArray("documentation");
36324        for (RelatedArtifact e : element.getDocumentation()) 
36325          composeRelatedArtifact(null, e);
36326        closeArray();
36327      };
36328      if (element.hasTarget()) {
36329        openArray("target");
36330        for (PlanDefinition.PlanDefinitionGoalTargetComponent e : element.getTarget()) 
36331          composePlanDefinitionPlanDefinitionGoalTargetComponent(null, e);
36332        closeArray();
36333      };
36334  }
36335
36336  protected void composePlanDefinitionPlanDefinitionGoalTargetComponent(String name, PlanDefinition.PlanDefinitionGoalTargetComponent element) throws IOException {
36337    if (element != null) {
36338      open(name);
36339      composePlanDefinitionPlanDefinitionGoalTargetComponentInner(element);
36340      close();
36341    }
36342  }
36343
36344  protected void composePlanDefinitionPlanDefinitionGoalTargetComponentInner(PlanDefinition.PlanDefinitionGoalTargetComponent element) throws IOException {
36345      composeBackbone(element);
36346      if (element.hasMeasure()) {
36347        composeCodeableConcept("measure", element.getMeasure());
36348      }
36349      if (element.hasDetail()) {
36350        composeType("detail", element.getDetail());
36351      }
36352      if (element.hasDue()) {
36353        composeDuration("due", element.getDue());
36354      }
36355  }
36356
36357  protected void composePlanDefinitionPlanDefinitionActionComponent(String name, PlanDefinition.PlanDefinitionActionComponent element) throws IOException {
36358    if (element != null) {
36359      open(name);
36360      composePlanDefinitionPlanDefinitionActionComponentInner(element);
36361      close();
36362    }
36363  }
36364
36365  protected void composePlanDefinitionPlanDefinitionActionComponentInner(PlanDefinition.PlanDefinitionActionComponent element) throws IOException {
36366      composeBackbone(element);
36367      if (element.hasLabelElement()) {
36368        composeStringCore("label", element.getLabelElement(), false);
36369        composeStringExtras("label", element.getLabelElement(), false);
36370      }
36371      if (element.hasTitleElement()) {
36372        composeStringCore("title", element.getTitleElement(), false);
36373        composeStringExtras("title", element.getTitleElement(), false);
36374      }
36375      if (element.hasDescriptionElement()) {
36376        composeStringCore("description", element.getDescriptionElement(), false);
36377        composeStringExtras("description", element.getDescriptionElement(), false);
36378      }
36379      if (element.hasTextEquivalentElement()) {
36380        composeStringCore("textEquivalent", element.getTextEquivalentElement(), false);
36381        composeStringExtras("textEquivalent", element.getTextEquivalentElement(), false);
36382      }
36383      if (element.hasCode()) {
36384        openArray("code");
36385        for (CodeableConcept e : element.getCode()) 
36386          composeCodeableConcept(null, e);
36387        closeArray();
36388      };
36389      if (element.hasReason()) {
36390        openArray("reason");
36391        for (CodeableConcept e : element.getReason()) 
36392          composeCodeableConcept(null, e);
36393        closeArray();
36394      };
36395      if (element.hasDocumentation()) {
36396        openArray("documentation");
36397        for (RelatedArtifact e : element.getDocumentation()) 
36398          composeRelatedArtifact(null, e);
36399        closeArray();
36400      };
36401      if (element.hasGoalId()) {
36402        openArray("goalId");
36403        for (IdType e : element.getGoalId()) 
36404          composeIdCore(null, e, true);
36405        closeArray();
36406        if (anyHasExtras(element.getGoalId())) {
36407          openArray("_goalId");
36408          for (IdType e : element.getGoalId()) 
36409            composeIdExtras(null, e, true);
36410          closeArray();
36411        }
36412      };
36413      if (element.hasTriggerDefinition()) {
36414        openArray("triggerDefinition");
36415        for (TriggerDefinition e : element.getTriggerDefinition()) 
36416          composeTriggerDefinition(null, e);
36417        closeArray();
36418      };
36419      if (element.hasCondition()) {
36420        openArray("condition");
36421        for (PlanDefinition.PlanDefinitionActionConditionComponent e : element.getCondition()) 
36422          composePlanDefinitionPlanDefinitionActionConditionComponent(null, e);
36423        closeArray();
36424      };
36425      if (element.hasInput()) {
36426        openArray("input");
36427        for (DataRequirement e : element.getInput()) 
36428          composeDataRequirement(null, e);
36429        closeArray();
36430      };
36431      if (element.hasOutput()) {
36432        openArray("output");
36433        for (DataRequirement e : element.getOutput()) 
36434          composeDataRequirement(null, e);
36435        closeArray();
36436      };
36437      if (element.hasRelatedAction()) {
36438        openArray("relatedAction");
36439        for (PlanDefinition.PlanDefinitionActionRelatedActionComponent e : element.getRelatedAction()) 
36440          composePlanDefinitionPlanDefinitionActionRelatedActionComponent(null, e);
36441        closeArray();
36442      };
36443      if (element.hasTiming()) {
36444        composeType("timing", element.getTiming());
36445      }
36446      if (element.hasParticipant()) {
36447        openArray("participant");
36448        for (PlanDefinition.PlanDefinitionActionParticipantComponent e : element.getParticipant()) 
36449          composePlanDefinitionPlanDefinitionActionParticipantComponent(null, e);
36450        closeArray();
36451      };
36452      if (element.hasType()) {
36453        composeCoding("type", element.getType());
36454      }
36455      if (element.hasGroupingBehaviorElement()) {
36456        composeEnumerationCore("groupingBehavior", element.getGroupingBehaviorElement(), new PlanDefinition.ActionGroupingBehaviorEnumFactory(), false);
36457        composeEnumerationExtras("groupingBehavior", element.getGroupingBehaviorElement(), new PlanDefinition.ActionGroupingBehaviorEnumFactory(), false);
36458      }
36459      if (element.hasSelectionBehaviorElement()) {
36460        composeEnumerationCore("selectionBehavior", element.getSelectionBehaviorElement(), new PlanDefinition.ActionSelectionBehaviorEnumFactory(), false);
36461        composeEnumerationExtras("selectionBehavior", element.getSelectionBehaviorElement(), new PlanDefinition.ActionSelectionBehaviorEnumFactory(), false);
36462      }
36463      if (element.hasRequiredBehaviorElement()) {
36464        composeEnumerationCore("requiredBehavior", element.getRequiredBehaviorElement(), new PlanDefinition.ActionRequiredBehaviorEnumFactory(), false);
36465        composeEnumerationExtras("requiredBehavior", element.getRequiredBehaviorElement(), new PlanDefinition.ActionRequiredBehaviorEnumFactory(), false);
36466      }
36467      if (element.hasPrecheckBehaviorElement()) {
36468        composeEnumerationCore("precheckBehavior", element.getPrecheckBehaviorElement(), new PlanDefinition.ActionPrecheckBehaviorEnumFactory(), false);
36469        composeEnumerationExtras("precheckBehavior", element.getPrecheckBehaviorElement(), new PlanDefinition.ActionPrecheckBehaviorEnumFactory(), false);
36470      }
36471      if (element.hasCardinalityBehaviorElement()) {
36472        composeEnumerationCore("cardinalityBehavior", element.getCardinalityBehaviorElement(), new PlanDefinition.ActionCardinalityBehaviorEnumFactory(), false);
36473        composeEnumerationExtras("cardinalityBehavior", element.getCardinalityBehaviorElement(), new PlanDefinition.ActionCardinalityBehaviorEnumFactory(), false);
36474      }
36475      if (element.hasDefinition()) {
36476        composeReference("definition", element.getDefinition());
36477      }
36478      if (element.hasTransform()) {
36479        composeReference("transform", element.getTransform());
36480      }
36481      if (element.hasDynamicValue()) {
36482        openArray("dynamicValue");
36483        for (PlanDefinition.PlanDefinitionActionDynamicValueComponent e : element.getDynamicValue()) 
36484          composePlanDefinitionPlanDefinitionActionDynamicValueComponent(null, e);
36485        closeArray();
36486      };
36487      if (element.hasAction()) {
36488        openArray("action");
36489        for (PlanDefinition.PlanDefinitionActionComponent e : element.getAction()) 
36490          composePlanDefinitionPlanDefinitionActionComponent(null, e);
36491        closeArray();
36492      };
36493  }
36494
36495  protected void composePlanDefinitionPlanDefinitionActionConditionComponent(String name, PlanDefinition.PlanDefinitionActionConditionComponent element) throws IOException {
36496    if (element != null) {
36497      open(name);
36498      composePlanDefinitionPlanDefinitionActionConditionComponentInner(element);
36499      close();
36500    }
36501  }
36502
36503  protected void composePlanDefinitionPlanDefinitionActionConditionComponentInner(PlanDefinition.PlanDefinitionActionConditionComponent element) throws IOException {
36504      composeBackbone(element);
36505      if (element.hasKindElement()) {
36506        composeEnumerationCore("kind", element.getKindElement(), new PlanDefinition.ActionConditionKindEnumFactory(), false);
36507        composeEnumerationExtras("kind", element.getKindElement(), new PlanDefinition.ActionConditionKindEnumFactory(), false);
36508      }
36509      if (element.hasDescriptionElement()) {
36510        composeStringCore("description", element.getDescriptionElement(), false);
36511        composeStringExtras("description", element.getDescriptionElement(), false);
36512      }
36513      if (element.hasLanguageElement()) {
36514        composeStringCore("language", element.getLanguageElement(), false);
36515        composeStringExtras("language", element.getLanguageElement(), false);
36516      }
36517      if (element.hasExpressionElement()) {
36518        composeStringCore("expression", element.getExpressionElement(), false);
36519        composeStringExtras("expression", element.getExpressionElement(), false);
36520      }
36521  }
36522
36523  protected void composePlanDefinitionPlanDefinitionActionRelatedActionComponent(String name, PlanDefinition.PlanDefinitionActionRelatedActionComponent element) throws IOException {
36524    if (element != null) {
36525      open(name);
36526      composePlanDefinitionPlanDefinitionActionRelatedActionComponentInner(element);
36527      close();
36528    }
36529  }
36530
36531  protected void composePlanDefinitionPlanDefinitionActionRelatedActionComponentInner(PlanDefinition.PlanDefinitionActionRelatedActionComponent element) throws IOException {
36532      composeBackbone(element);
36533      if (element.hasActionIdElement()) {
36534        composeIdCore("actionId", element.getActionIdElement(), false);
36535        composeIdExtras("actionId", element.getActionIdElement(), false);
36536      }
36537      if (element.hasRelationshipElement()) {
36538        composeEnumerationCore("relationship", element.getRelationshipElement(), new PlanDefinition.ActionRelationshipTypeEnumFactory(), false);
36539        composeEnumerationExtras("relationship", element.getRelationshipElement(), new PlanDefinition.ActionRelationshipTypeEnumFactory(), false);
36540      }
36541      if (element.hasOffset()) {
36542        composeType("offset", element.getOffset());
36543      }
36544  }
36545
36546  protected void composePlanDefinitionPlanDefinitionActionParticipantComponent(String name, PlanDefinition.PlanDefinitionActionParticipantComponent element) throws IOException {
36547    if (element != null) {
36548      open(name);
36549      composePlanDefinitionPlanDefinitionActionParticipantComponentInner(element);
36550      close();
36551    }
36552  }
36553
36554  protected void composePlanDefinitionPlanDefinitionActionParticipantComponentInner(PlanDefinition.PlanDefinitionActionParticipantComponent element) throws IOException {
36555      composeBackbone(element);
36556      if (element.hasTypeElement()) {
36557        composeEnumerationCore("type", element.getTypeElement(), new PlanDefinition.ActionParticipantTypeEnumFactory(), false);
36558        composeEnumerationExtras("type", element.getTypeElement(), new PlanDefinition.ActionParticipantTypeEnumFactory(), false);
36559      }
36560      if (element.hasRole()) {
36561        composeCodeableConcept("role", element.getRole());
36562      }
36563  }
36564
36565  protected void composePlanDefinitionPlanDefinitionActionDynamicValueComponent(String name, PlanDefinition.PlanDefinitionActionDynamicValueComponent element) throws IOException {
36566    if (element != null) {
36567      open(name);
36568      composePlanDefinitionPlanDefinitionActionDynamicValueComponentInner(element);
36569      close();
36570    }
36571  }
36572
36573  protected void composePlanDefinitionPlanDefinitionActionDynamicValueComponentInner(PlanDefinition.PlanDefinitionActionDynamicValueComponent element) throws IOException {
36574      composeBackbone(element);
36575      if (element.hasDescriptionElement()) {
36576        composeStringCore("description", element.getDescriptionElement(), false);
36577        composeStringExtras("description", element.getDescriptionElement(), false);
36578      }
36579      if (element.hasPathElement()) {
36580        composeStringCore("path", element.getPathElement(), false);
36581        composeStringExtras("path", element.getPathElement(), false);
36582      }
36583      if (element.hasLanguageElement()) {
36584        composeStringCore("language", element.getLanguageElement(), false);
36585        composeStringExtras("language", element.getLanguageElement(), false);
36586      }
36587      if (element.hasExpressionElement()) {
36588        composeStringCore("expression", element.getExpressionElement(), false);
36589        composeStringExtras("expression", element.getExpressionElement(), false);
36590      }
36591  }
36592
36593  protected void composePractitioner(String name, Practitioner element) throws IOException {
36594    if (element != null) {
36595      prop("resourceType", name);
36596      composePractitionerInner(element);
36597    }
36598  }
36599
36600  protected void composePractitionerInner(Practitioner element) throws IOException {
36601      composeDomainResourceElements(element);
36602      if (element.hasIdentifier()) {
36603        openArray("identifier");
36604        for (Identifier e : element.getIdentifier()) 
36605          composeIdentifier(null, e);
36606        closeArray();
36607      };
36608      if (element.hasActiveElement()) {
36609        composeBooleanCore("active", element.getActiveElement(), false);
36610        composeBooleanExtras("active", element.getActiveElement(), false);
36611      }
36612      if (element.hasName()) {
36613        openArray("name");
36614        for (HumanName e : element.getName()) 
36615          composeHumanName(null, e);
36616        closeArray();
36617      };
36618      if (element.hasTelecom()) {
36619        openArray("telecom");
36620        for (ContactPoint e : element.getTelecom()) 
36621          composeContactPoint(null, e);
36622        closeArray();
36623      };
36624      if (element.hasAddress()) {
36625        openArray("address");
36626        for (Address e : element.getAddress()) 
36627          composeAddress(null, e);
36628        closeArray();
36629      };
36630      if (element.hasGenderElement()) {
36631        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
36632        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
36633      }
36634      if (element.hasBirthDateElement()) {
36635        composeDateCore("birthDate", element.getBirthDateElement(), false);
36636        composeDateExtras("birthDate", element.getBirthDateElement(), false);
36637      }
36638      if (element.hasPhoto()) {
36639        openArray("photo");
36640        for (Attachment e : element.getPhoto()) 
36641          composeAttachment(null, e);
36642        closeArray();
36643      };
36644      if (element.hasQualification()) {
36645        openArray("qualification");
36646        for (Practitioner.PractitionerQualificationComponent e : element.getQualification()) 
36647          composePractitionerPractitionerQualificationComponent(null, e);
36648        closeArray();
36649      };
36650      if (element.hasCommunication()) {
36651        openArray("communication");
36652        for (CodeableConcept e : element.getCommunication()) 
36653          composeCodeableConcept(null, e);
36654        closeArray();
36655      };
36656  }
36657
36658  protected void composePractitionerPractitionerQualificationComponent(String name, Practitioner.PractitionerQualificationComponent element) throws IOException {
36659    if (element != null) {
36660      open(name);
36661      composePractitionerPractitionerQualificationComponentInner(element);
36662      close();
36663    }
36664  }
36665
36666  protected void composePractitionerPractitionerQualificationComponentInner(Practitioner.PractitionerQualificationComponent element) throws IOException {
36667      composeBackbone(element);
36668      if (element.hasIdentifier()) {
36669        openArray("identifier");
36670        for (Identifier e : element.getIdentifier()) 
36671          composeIdentifier(null, e);
36672        closeArray();
36673      };
36674      if (element.hasCode()) {
36675        composeCodeableConcept("code", element.getCode());
36676      }
36677      if (element.hasPeriod()) {
36678        composePeriod("period", element.getPeriod());
36679      }
36680      if (element.hasIssuer()) {
36681        composeReference("issuer", element.getIssuer());
36682      }
36683  }
36684
36685  protected void composePractitionerRole(String name, PractitionerRole element) throws IOException {
36686    if (element != null) {
36687      prop("resourceType", name);
36688      composePractitionerRoleInner(element);
36689    }
36690  }
36691
36692  protected void composePractitionerRoleInner(PractitionerRole element) throws IOException {
36693      composeDomainResourceElements(element);
36694      if (element.hasIdentifier()) {
36695        openArray("identifier");
36696        for (Identifier e : element.getIdentifier()) 
36697          composeIdentifier(null, e);
36698        closeArray();
36699      };
36700      if (element.hasActiveElement()) {
36701        composeBooleanCore("active", element.getActiveElement(), false);
36702        composeBooleanExtras("active", element.getActiveElement(), false);
36703      }
36704      if (element.hasPeriod()) {
36705        composePeriod("period", element.getPeriod());
36706      }
36707      if (element.hasPractitioner()) {
36708        composeReference("practitioner", element.getPractitioner());
36709      }
36710      if (element.hasOrganization()) {
36711        composeReference("organization", element.getOrganization());
36712      }
36713      if (element.hasCode()) {
36714        openArray("code");
36715        for (CodeableConcept e : element.getCode()) 
36716          composeCodeableConcept(null, e);
36717        closeArray();
36718      };
36719      if (element.hasSpecialty()) {
36720        openArray("specialty");
36721        for (CodeableConcept e : element.getSpecialty()) 
36722          composeCodeableConcept(null, e);
36723        closeArray();
36724      };
36725      if (element.hasLocation()) {
36726        openArray("location");
36727        for (Reference e : element.getLocation()) 
36728          composeReference(null, e);
36729        closeArray();
36730      };
36731      if (element.hasHealthcareService()) {
36732        openArray("healthcareService");
36733        for (Reference e : element.getHealthcareService()) 
36734          composeReference(null, e);
36735        closeArray();
36736      };
36737      if (element.hasTelecom()) {
36738        openArray("telecom");
36739        for (ContactPoint e : element.getTelecom()) 
36740          composeContactPoint(null, e);
36741        closeArray();
36742      };
36743      if (element.hasAvailableTime()) {
36744        openArray("availableTime");
36745        for (PractitionerRole.PractitionerRoleAvailableTimeComponent e : element.getAvailableTime()) 
36746          composePractitionerRolePractitionerRoleAvailableTimeComponent(null, e);
36747        closeArray();
36748      };
36749      if (element.hasNotAvailable()) {
36750        openArray("notAvailable");
36751        for (PractitionerRole.PractitionerRoleNotAvailableComponent e : element.getNotAvailable()) 
36752          composePractitionerRolePractitionerRoleNotAvailableComponent(null, e);
36753        closeArray();
36754      };
36755      if (element.hasAvailabilityExceptionsElement()) {
36756        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
36757        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
36758      }
36759      if (element.hasEndpoint()) {
36760        openArray("endpoint");
36761        for (Reference e : element.getEndpoint()) 
36762          composeReference(null, e);
36763        closeArray();
36764      };
36765  }
36766
36767  protected void composePractitionerRolePractitionerRoleAvailableTimeComponent(String name, PractitionerRole.PractitionerRoleAvailableTimeComponent element) throws IOException {
36768    if (element != null) {
36769      open(name);
36770      composePractitionerRolePractitionerRoleAvailableTimeComponentInner(element);
36771      close();
36772    }
36773  }
36774
36775  protected void composePractitionerRolePractitionerRoleAvailableTimeComponentInner(PractitionerRole.PractitionerRoleAvailableTimeComponent element) throws IOException {
36776      composeBackbone(element);
36777      if (element.hasDaysOfWeek()) {
36778        openArray("daysOfWeek");
36779        for (Enumeration<PractitionerRole.DaysOfWeek> e : element.getDaysOfWeek()) 
36780          composeEnumerationCore(null, e, new PractitionerRole.DaysOfWeekEnumFactory(), true);
36781        closeArray();
36782        if (anyHasExtras(element.getDaysOfWeek())) {
36783          openArray("_daysOfWeek");
36784          for (Enumeration<PractitionerRole.DaysOfWeek> e : element.getDaysOfWeek()) 
36785            composeEnumerationExtras(null, e, new PractitionerRole.DaysOfWeekEnumFactory(), true);
36786          closeArray();
36787        }
36788      };
36789      if (element.hasAllDayElement()) {
36790        composeBooleanCore("allDay", element.getAllDayElement(), false);
36791        composeBooleanExtras("allDay", element.getAllDayElement(), false);
36792      }
36793      if (element.hasAvailableStartTimeElement()) {
36794        composeTimeCore("availableStartTime", element.getAvailableStartTimeElement(), false);
36795        composeTimeExtras("availableStartTime", element.getAvailableStartTimeElement(), false);
36796      }
36797      if (element.hasAvailableEndTimeElement()) {
36798        composeTimeCore("availableEndTime", element.getAvailableEndTimeElement(), false);
36799        composeTimeExtras("availableEndTime", element.getAvailableEndTimeElement(), false);
36800      }
36801  }
36802
36803  protected void composePractitionerRolePractitionerRoleNotAvailableComponent(String name, PractitionerRole.PractitionerRoleNotAvailableComponent element) throws IOException {
36804    if (element != null) {
36805      open(name);
36806      composePractitionerRolePractitionerRoleNotAvailableComponentInner(element);
36807      close();
36808    }
36809  }
36810
36811  protected void composePractitionerRolePractitionerRoleNotAvailableComponentInner(PractitionerRole.PractitionerRoleNotAvailableComponent element) throws IOException {
36812      composeBackbone(element);
36813      if (element.hasDescriptionElement()) {
36814        composeStringCore("description", element.getDescriptionElement(), false);
36815        composeStringExtras("description", element.getDescriptionElement(), false);
36816      }
36817      if (element.hasDuring()) {
36818        composePeriod("during", element.getDuring());
36819      }
36820  }
36821
36822  protected void composeProcedure(String name, Procedure element) throws IOException {
36823    if (element != null) {
36824      prop("resourceType", name);
36825      composeProcedureInner(element);
36826    }
36827  }
36828
36829  protected void composeProcedureInner(Procedure element) throws IOException {
36830      composeDomainResourceElements(element);
36831      if (element.hasIdentifier()) {
36832        openArray("identifier");
36833        for (Identifier e : element.getIdentifier()) 
36834          composeIdentifier(null, e);
36835        closeArray();
36836      };
36837      if (element.hasDefinition()) {
36838        openArray("definition");
36839        for (Reference e : element.getDefinition()) 
36840          composeReference(null, e);
36841        closeArray();
36842      };
36843      if (element.hasBasedOn()) {
36844        openArray("basedOn");
36845        for (Reference e : element.getBasedOn()) 
36846          composeReference(null, e);
36847        closeArray();
36848      };
36849      if (element.hasPartOf()) {
36850        openArray("partOf");
36851        for (Reference e : element.getPartOf()) 
36852          composeReference(null, e);
36853        closeArray();
36854      };
36855      if (element.hasStatusElement()) {
36856        composeEnumerationCore("status", element.getStatusElement(), new Procedure.ProcedureStatusEnumFactory(), false);
36857        composeEnumerationExtras("status", element.getStatusElement(), new Procedure.ProcedureStatusEnumFactory(), false);
36858      }
36859      if (element.hasNotDoneElement()) {
36860        composeBooleanCore("notDone", element.getNotDoneElement(), false);
36861        composeBooleanExtras("notDone", element.getNotDoneElement(), false);
36862      }
36863      if (element.hasNotDoneReason()) {
36864        composeCodeableConcept("notDoneReason", element.getNotDoneReason());
36865      }
36866      if (element.hasCategory()) {
36867        composeCodeableConcept("category", element.getCategory());
36868      }
36869      if (element.hasCode()) {
36870        composeCodeableConcept("code", element.getCode());
36871      }
36872      if (element.hasSubject()) {
36873        composeReference("subject", element.getSubject());
36874      }
36875      if (element.hasContext()) {
36876        composeReference("context", element.getContext());
36877      }
36878      if (element.hasPerformed()) {
36879        composeType("performed", element.getPerformed());
36880      }
36881      if (element.hasPerformer()) {
36882        openArray("performer");
36883        for (Procedure.ProcedurePerformerComponent e : element.getPerformer()) 
36884          composeProcedureProcedurePerformerComponent(null, e);
36885        closeArray();
36886      };
36887      if (element.hasLocation()) {
36888        composeReference("location", element.getLocation());
36889      }
36890      if (element.hasReasonCode()) {
36891        openArray("reasonCode");
36892        for (CodeableConcept e : element.getReasonCode()) 
36893          composeCodeableConcept(null, e);
36894        closeArray();
36895      };
36896      if (element.hasReasonReference()) {
36897        openArray("reasonReference");
36898        for (Reference e : element.getReasonReference()) 
36899          composeReference(null, e);
36900        closeArray();
36901      };
36902      if (element.hasBodySite()) {
36903        openArray("bodySite");
36904        for (CodeableConcept e : element.getBodySite()) 
36905          composeCodeableConcept(null, e);
36906        closeArray();
36907      };
36908      if (element.hasOutcome()) {
36909        composeCodeableConcept("outcome", element.getOutcome());
36910      }
36911      if (element.hasReport()) {
36912        openArray("report");
36913        for (Reference e : element.getReport()) 
36914          composeReference(null, e);
36915        closeArray();
36916      };
36917      if (element.hasComplication()) {
36918        openArray("complication");
36919        for (CodeableConcept e : element.getComplication()) 
36920          composeCodeableConcept(null, e);
36921        closeArray();
36922      };
36923      if (element.hasComplicationDetail()) {
36924        openArray("complicationDetail");
36925        for (Reference e : element.getComplicationDetail()) 
36926          composeReference(null, e);
36927        closeArray();
36928      };
36929      if (element.hasFollowUp()) {
36930        openArray("followUp");
36931        for (CodeableConcept e : element.getFollowUp()) 
36932          composeCodeableConcept(null, e);
36933        closeArray();
36934      };
36935      if (element.hasNote()) {
36936        openArray("note");
36937        for (Annotation e : element.getNote()) 
36938          composeAnnotation(null, e);
36939        closeArray();
36940      };
36941      if (element.hasFocalDevice()) {
36942        openArray("focalDevice");
36943        for (Procedure.ProcedureFocalDeviceComponent e : element.getFocalDevice()) 
36944          composeProcedureProcedureFocalDeviceComponent(null, e);
36945        closeArray();
36946      };
36947      if (element.hasUsedReference()) {
36948        openArray("usedReference");
36949        for (Reference e : element.getUsedReference()) 
36950          composeReference(null, e);
36951        closeArray();
36952      };
36953      if (element.hasUsedCode()) {
36954        openArray("usedCode");
36955        for (CodeableConcept e : element.getUsedCode()) 
36956          composeCodeableConcept(null, e);
36957        closeArray();
36958      };
36959  }
36960
36961  protected void composeProcedureProcedurePerformerComponent(String name, Procedure.ProcedurePerformerComponent element) throws IOException {
36962    if (element != null) {
36963      open(name);
36964      composeProcedureProcedurePerformerComponentInner(element);
36965      close();
36966    }
36967  }
36968
36969  protected void composeProcedureProcedurePerformerComponentInner(Procedure.ProcedurePerformerComponent element) throws IOException {
36970      composeBackbone(element);
36971      if (element.hasRole()) {
36972        composeCodeableConcept("role", element.getRole());
36973      }
36974      if (element.hasActor()) {
36975        composeReference("actor", element.getActor());
36976      }
36977      if (element.hasOnBehalfOf()) {
36978        composeReference("onBehalfOf", element.getOnBehalfOf());
36979      }
36980  }
36981
36982  protected void composeProcedureProcedureFocalDeviceComponent(String name, Procedure.ProcedureFocalDeviceComponent element) throws IOException {
36983    if (element != null) {
36984      open(name);
36985      composeProcedureProcedureFocalDeviceComponentInner(element);
36986      close();
36987    }
36988  }
36989
36990  protected void composeProcedureProcedureFocalDeviceComponentInner(Procedure.ProcedureFocalDeviceComponent element) throws IOException {
36991      composeBackbone(element);
36992      if (element.hasAction()) {
36993        composeCodeableConcept("action", element.getAction());
36994      }
36995      if (element.hasManipulated()) {
36996        composeReference("manipulated", element.getManipulated());
36997      }
36998  }
36999
37000  protected void composeProcedureRequest(String name, ProcedureRequest element) throws IOException {
37001    if (element != null) {
37002      prop("resourceType", name);
37003      composeProcedureRequestInner(element);
37004    }
37005  }
37006
37007  protected void composeProcedureRequestInner(ProcedureRequest element) throws IOException {
37008      composeDomainResourceElements(element);
37009      if (element.hasIdentifier()) {
37010        openArray("identifier");
37011        for (Identifier e : element.getIdentifier()) 
37012          composeIdentifier(null, e);
37013        closeArray();
37014      };
37015      if (element.hasDefinition()) {
37016        openArray("definition");
37017        for (Reference e : element.getDefinition()) 
37018          composeReference(null, e);
37019        closeArray();
37020      };
37021      if (element.hasBasedOn()) {
37022        openArray("basedOn");
37023        for (Reference e : element.getBasedOn()) 
37024          composeReference(null, e);
37025        closeArray();
37026      };
37027      if (element.hasReplaces()) {
37028        openArray("replaces");
37029        for (Reference e : element.getReplaces()) 
37030          composeReference(null, e);
37031        closeArray();
37032      };
37033      if (element.hasRequisition()) {
37034        composeIdentifier("requisition", element.getRequisition());
37035      }
37036      if (element.hasStatusElement()) {
37037        composeEnumerationCore("status", element.getStatusElement(), new ProcedureRequest.ProcedureRequestStatusEnumFactory(), false);
37038        composeEnumerationExtras("status", element.getStatusElement(), new ProcedureRequest.ProcedureRequestStatusEnumFactory(), false);
37039      }
37040      if (element.hasIntentElement()) {
37041        composeEnumerationCore("intent", element.getIntentElement(), new ProcedureRequest.ProcedureRequestIntentEnumFactory(), false);
37042        composeEnumerationExtras("intent", element.getIntentElement(), new ProcedureRequest.ProcedureRequestIntentEnumFactory(), false);
37043      }
37044      if (element.hasPriorityElement()) {
37045        composeEnumerationCore("priority", element.getPriorityElement(), new ProcedureRequest.ProcedureRequestPriorityEnumFactory(), false);
37046        composeEnumerationExtras("priority", element.getPriorityElement(), new ProcedureRequest.ProcedureRequestPriorityEnumFactory(), false);
37047      }
37048      if (element.hasDoNotPerformElement()) {
37049        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
37050        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
37051      }
37052      if (element.hasCategory()) {
37053        openArray("category");
37054        for (CodeableConcept e : element.getCategory()) 
37055          composeCodeableConcept(null, e);
37056        closeArray();
37057      };
37058      if (element.hasCode()) {
37059        composeCodeableConcept("code", element.getCode());
37060      }
37061      if (element.hasSubject()) {
37062        composeReference("subject", element.getSubject());
37063      }
37064      if (element.hasContext()) {
37065        composeReference("context", element.getContext());
37066      }
37067      if (element.hasOccurrence()) {
37068        composeType("occurrence", element.getOccurrence());
37069      }
37070      if (element.hasAsNeeded()) {
37071        composeType("asNeeded", element.getAsNeeded());
37072      }
37073      if (element.hasAuthoredOnElement()) {
37074        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
37075        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
37076      }
37077      if (element.hasRequester()) {
37078        composeProcedureRequestProcedureRequestRequesterComponent("requester", element.getRequester());
37079      }
37080      if (element.hasPerformerType()) {
37081        composeCodeableConcept("performerType", element.getPerformerType());
37082      }
37083      if (element.hasPerformer()) {
37084        composeReference("performer", element.getPerformer());
37085      }
37086      if (element.hasReasonCode()) {
37087        openArray("reasonCode");
37088        for (CodeableConcept e : element.getReasonCode()) 
37089          composeCodeableConcept(null, e);
37090        closeArray();
37091      };
37092      if (element.hasReasonReference()) {
37093        openArray("reasonReference");
37094        for (Reference e : element.getReasonReference()) 
37095          composeReference(null, e);
37096        closeArray();
37097      };
37098      if (element.hasSupportingInfo()) {
37099        openArray("supportingInfo");
37100        for (Reference e : element.getSupportingInfo()) 
37101          composeReference(null, e);
37102        closeArray();
37103      };
37104      if (element.hasSpecimen()) {
37105        openArray("specimen");
37106        for (Reference e : element.getSpecimen()) 
37107          composeReference(null, e);
37108        closeArray();
37109      };
37110      if (element.hasBodySite()) {
37111        openArray("bodySite");
37112        for (CodeableConcept e : element.getBodySite()) 
37113          composeCodeableConcept(null, e);
37114        closeArray();
37115      };
37116      if (element.hasNote()) {
37117        openArray("note");
37118        for (Annotation e : element.getNote()) 
37119          composeAnnotation(null, e);
37120        closeArray();
37121      };
37122      if (element.hasRelevantHistory()) {
37123        openArray("relevantHistory");
37124        for (Reference e : element.getRelevantHistory()) 
37125          composeReference(null, e);
37126        closeArray();
37127      };
37128  }
37129
37130  protected void composeProcedureRequestProcedureRequestRequesterComponent(String name, ProcedureRequest.ProcedureRequestRequesterComponent element) throws IOException {
37131    if (element != null) {
37132      open(name);
37133      composeProcedureRequestProcedureRequestRequesterComponentInner(element);
37134      close();
37135    }
37136  }
37137
37138  protected void composeProcedureRequestProcedureRequestRequesterComponentInner(ProcedureRequest.ProcedureRequestRequesterComponent element) throws IOException {
37139      composeBackbone(element);
37140      if (element.hasAgent()) {
37141        composeReference("agent", element.getAgent());
37142      }
37143      if (element.hasOnBehalfOf()) {
37144        composeReference("onBehalfOf", element.getOnBehalfOf());
37145      }
37146  }
37147
37148  protected void composeProcessRequest(String name, ProcessRequest element) throws IOException {
37149    if (element != null) {
37150      prop("resourceType", name);
37151      composeProcessRequestInner(element);
37152    }
37153  }
37154
37155  protected void composeProcessRequestInner(ProcessRequest element) throws IOException {
37156      composeDomainResourceElements(element);
37157      if (element.hasIdentifier()) {
37158        openArray("identifier");
37159        for (Identifier e : element.getIdentifier()) 
37160          composeIdentifier(null, e);
37161        closeArray();
37162      };
37163      if (element.hasStatusElement()) {
37164        composeEnumerationCore("status", element.getStatusElement(), new ProcessRequest.ProcessRequestStatusEnumFactory(), false);
37165        composeEnumerationExtras("status", element.getStatusElement(), new ProcessRequest.ProcessRequestStatusEnumFactory(), false);
37166      }
37167      if (element.hasActionElement()) {
37168        composeEnumerationCore("action", element.getActionElement(), new ProcessRequest.ActionListEnumFactory(), false);
37169        composeEnumerationExtras("action", element.getActionElement(), new ProcessRequest.ActionListEnumFactory(), false);
37170      }
37171      if (element.hasTarget()) {
37172        composeReference("target", element.getTarget());
37173      }
37174      if (element.hasCreatedElement()) {
37175        composeDateTimeCore("created", element.getCreatedElement(), false);
37176        composeDateTimeExtras("created", element.getCreatedElement(), false);
37177      }
37178      if (element.hasProvider()) {
37179        composeReference("provider", element.getProvider());
37180      }
37181      if (element.hasOrganization()) {
37182        composeReference("organization", element.getOrganization());
37183      }
37184      if (element.hasRequest()) {
37185        composeReference("request", element.getRequest());
37186      }
37187      if (element.hasResponse()) {
37188        composeReference("response", element.getResponse());
37189      }
37190      if (element.hasNullifyElement()) {
37191        composeBooleanCore("nullify", element.getNullifyElement(), false);
37192        composeBooleanExtras("nullify", element.getNullifyElement(), false);
37193      }
37194      if (element.hasReferenceElement()) {
37195        composeStringCore("reference", element.getReferenceElement(), false);
37196        composeStringExtras("reference", element.getReferenceElement(), false);
37197      }
37198      if (element.hasItem()) {
37199        openArray("item");
37200        for (ProcessRequest.ItemsComponent e : element.getItem()) 
37201          composeProcessRequestItemsComponent(null, e);
37202        closeArray();
37203      };
37204      if (element.hasInclude()) {
37205        openArray("include");
37206        for (StringType e : element.getInclude()) 
37207          composeStringCore(null, e, true);
37208        closeArray();
37209        if (anyHasExtras(element.getInclude())) {
37210          openArray("_include");
37211          for (StringType e : element.getInclude()) 
37212            composeStringExtras(null, e, true);
37213          closeArray();
37214        }
37215      };
37216      if (element.hasExclude()) {
37217        openArray("exclude");
37218        for (StringType e : element.getExclude()) 
37219          composeStringCore(null, e, true);
37220        closeArray();
37221        if (anyHasExtras(element.getExclude())) {
37222          openArray("_exclude");
37223          for (StringType e : element.getExclude()) 
37224            composeStringExtras(null, e, true);
37225          closeArray();
37226        }
37227      };
37228      if (element.hasPeriod()) {
37229        composePeriod("period", element.getPeriod());
37230      }
37231  }
37232
37233  protected void composeProcessRequestItemsComponent(String name, ProcessRequest.ItemsComponent element) throws IOException {
37234    if (element != null) {
37235      open(name);
37236      composeProcessRequestItemsComponentInner(element);
37237      close();
37238    }
37239  }
37240
37241  protected void composeProcessRequestItemsComponentInner(ProcessRequest.ItemsComponent element) throws IOException {
37242      composeBackbone(element);
37243      if (element.hasSequenceLinkIdElement()) {
37244        composeIntegerCore("sequenceLinkId", element.getSequenceLinkIdElement(), false);
37245        composeIntegerExtras("sequenceLinkId", element.getSequenceLinkIdElement(), false);
37246      }
37247  }
37248
37249  protected void composeProcessResponse(String name, ProcessResponse element) throws IOException {
37250    if (element != null) {
37251      prop("resourceType", name);
37252      composeProcessResponseInner(element);
37253    }
37254  }
37255
37256  protected void composeProcessResponseInner(ProcessResponse element) throws IOException {
37257      composeDomainResourceElements(element);
37258      if (element.hasIdentifier()) {
37259        openArray("identifier");
37260        for (Identifier e : element.getIdentifier()) 
37261          composeIdentifier(null, e);
37262        closeArray();
37263      };
37264      if (element.hasStatusElement()) {
37265        composeEnumerationCore("status", element.getStatusElement(), new ProcessResponse.ProcessResponseStatusEnumFactory(), false);
37266        composeEnumerationExtras("status", element.getStatusElement(), new ProcessResponse.ProcessResponseStatusEnumFactory(), false);
37267      }
37268      if (element.hasCreatedElement()) {
37269        composeDateTimeCore("created", element.getCreatedElement(), false);
37270        composeDateTimeExtras("created", element.getCreatedElement(), false);
37271      }
37272      if (element.hasOrganization()) {
37273        composeReference("organization", element.getOrganization());
37274      }
37275      if (element.hasRequest()) {
37276        composeReference("request", element.getRequest());
37277      }
37278      if (element.hasOutcome()) {
37279        composeCodeableConcept("outcome", element.getOutcome());
37280      }
37281      if (element.hasDispositionElement()) {
37282        composeStringCore("disposition", element.getDispositionElement(), false);
37283        composeStringExtras("disposition", element.getDispositionElement(), false);
37284      }
37285      if (element.hasRequestProvider()) {
37286        composeReference("requestProvider", element.getRequestProvider());
37287      }
37288      if (element.hasRequestOrganization()) {
37289        composeReference("requestOrganization", element.getRequestOrganization());
37290      }
37291      if (element.hasForm()) {
37292        composeCodeableConcept("form", element.getForm());
37293      }
37294      if (element.hasProcessNote()) {
37295        openArray("processNote");
37296        for (ProcessResponse.ProcessResponseProcessNoteComponent e : element.getProcessNote()) 
37297          composeProcessResponseProcessResponseProcessNoteComponent(null, e);
37298        closeArray();
37299      };
37300      if (element.hasError()) {
37301        openArray("error");
37302        for (CodeableConcept e : element.getError()) 
37303          composeCodeableConcept(null, e);
37304        closeArray();
37305      };
37306      if (element.hasCommunicationRequest()) {
37307        openArray("communicationRequest");
37308        for (Reference e : element.getCommunicationRequest()) 
37309          composeReference(null, e);
37310        closeArray();
37311      };
37312  }
37313
37314  protected void composeProcessResponseProcessResponseProcessNoteComponent(String name, ProcessResponse.ProcessResponseProcessNoteComponent element) throws IOException {
37315    if (element != null) {
37316      open(name);
37317      composeProcessResponseProcessResponseProcessNoteComponentInner(element);
37318      close();
37319    }
37320  }
37321
37322  protected void composeProcessResponseProcessResponseProcessNoteComponentInner(ProcessResponse.ProcessResponseProcessNoteComponent element) throws IOException {
37323      composeBackbone(element);
37324      if (element.hasType()) {
37325        composeCodeableConcept("type", element.getType());
37326      }
37327      if (element.hasTextElement()) {
37328        composeStringCore("text", element.getTextElement(), false);
37329        composeStringExtras("text", element.getTextElement(), false);
37330      }
37331  }
37332
37333  protected void composeProvenance(String name, Provenance element) throws IOException {
37334    if (element != null) {
37335      prop("resourceType", name);
37336      composeProvenanceInner(element);
37337    }
37338  }
37339
37340  protected void composeProvenanceInner(Provenance element) throws IOException {
37341      composeDomainResourceElements(element);
37342      if (element.hasTarget()) {
37343        openArray("target");
37344        for (Reference e : element.getTarget()) 
37345          composeReference(null, e);
37346        closeArray();
37347      };
37348      if (element.hasPeriod()) {
37349        composePeriod("period", element.getPeriod());
37350      }
37351      if (element.hasRecordedElement()) {
37352        composeInstantCore("recorded", element.getRecordedElement(), false);
37353        composeInstantExtras("recorded", element.getRecordedElement(), false);
37354      }
37355      if (element.hasPolicy()) {
37356        openArray("policy");
37357        for (UriType e : element.getPolicy()) 
37358          composeUriCore(null, e, true);
37359        closeArray();
37360        if (anyHasExtras(element.getPolicy())) {
37361          openArray("_policy");
37362          for (UriType e : element.getPolicy()) 
37363            composeUriExtras(null, e, true);
37364          closeArray();
37365        }
37366      };
37367      if (element.hasLocation()) {
37368        composeReference("location", element.getLocation());
37369      }
37370      if (element.hasReason()) {
37371        openArray("reason");
37372        for (Coding e : element.getReason()) 
37373          composeCoding(null, e);
37374        closeArray();
37375      };
37376      if (element.hasActivity()) {
37377        composeCoding("activity", element.getActivity());
37378      }
37379      if (element.hasAgent()) {
37380        openArray("agent");
37381        for (Provenance.ProvenanceAgentComponent e : element.getAgent()) 
37382          composeProvenanceProvenanceAgentComponent(null, e);
37383        closeArray();
37384      };
37385      if (element.hasEntity()) {
37386        openArray("entity");
37387        for (Provenance.ProvenanceEntityComponent e : element.getEntity()) 
37388          composeProvenanceProvenanceEntityComponent(null, e);
37389        closeArray();
37390      };
37391      if (element.hasSignature()) {
37392        openArray("signature");
37393        for (Signature e : element.getSignature()) 
37394          composeSignature(null, e);
37395        closeArray();
37396      };
37397  }
37398
37399  protected void composeProvenanceProvenanceAgentComponent(String name, Provenance.ProvenanceAgentComponent element) throws IOException {
37400    if (element != null) {
37401      open(name);
37402      composeProvenanceProvenanceAgentComponentInner(element);
37403      close();
37404    }
37405  }
37406
37407  protected void composeProvenanceProvenanceAgentComponentInner(Provenance.ProvenanceAgentComponent element) throws IOException {
37408      composeBackbone(element);
37409      if (element.hasRole()) {
37410        openArray("role");
37411        for (CodeableConcept e : element.getRole()) 
37412          composeCodeableConcept(null, e);
37413        closeArray();
37414      };
37415      if (element.hasWho()) {
37416        composeType("who", element.getWho());
37417      }
37418      if (element.hasOnBehalfOf()) {
37419        composeType("onBehalfOf", element.getOnBehalfOf());
37420      }
37421      if (element.hasRelatedAgentType()) {
37422        composeCodeableConcept("relatedAgentType", element.getRelatedAgentType());
37423      }
37424  }
37425
37426  protected void composeProvenanceProvenanceEntityComponent(String name, Provenance.ProvenanceEntityComponent element) throws IOException {
37427    if (element != null) {
37428      open(name);
37429      composeProvenanceProvenanceEntityComponentInner(element);
37430      close();
37431    }
37432  }
37433
37434  protected void composeProvenanceProvenanceEntityComponentInner(Provenance.ProvenanceEntityComponent element) throws IOException {
37435      composeBackbone(element);
37436      if (element.hasRoleElement()) {
37437        composeEnumerationCore("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory(), false);
37438        composeEnumerationExtras("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory(), false);
37439      }
37440      if (element.hasWhat()) {
37441        composeType("what", element.getWhat());
37442      }
37443      if (element.hasAgent()) {
37444        openArray("agent");
37445        for (Provenance.ProvenanceAgentComponent e : element.getAgent()) 
37446          composeProvenanceProvenanceAgentComponent(null, e);
37447        closeArray();
37448      };
37449  }
37450
37451  protected void composeQuestionnaire(String name, Questionnaire element) throws IOException {
37452    if (element != null) {
37453      prop("resourceType", name);
37454      composeQuestionnaireInner(element);
37455    }
37456  }
37457
37458  protected void composeQuestionnaireInner(Questionnaire element) throws IOException {
37459      composeDomainResourceElements(element);
37460      if (element.hasUrlElement()) {
37461        composeUriCore("url", element.getUrlElement(), false);
37462        composeUriExtras("url", element.getUrlElement(), false);
37463      }
37464      if (element.hasIdentifier()) {
37465        openArray("identifier");
37466        for (Identifier e : element.getIdentifier()) 
37467          composeIdentifier(null, e);
37468        closeArray();
37469      };
37470      if (element.hasVersionElement()) {
37471        composeStringCore("version", element.getVersionElement(), false);
37472        composeStringExtras("version", element.getVersionElement(), false);
37473      }
37474      if (element.hasNameElement()) {
37475        composeStringCore("name", element.getNameElement(), false);
37476        composeStringExtras("name", element.getNameElement(), false);
37477      }
37478      if (element.hasTitleElement()) {
37479        composeStringCore("title", element.getTitleElement(), false);
37480        composeStringExtras("title", element.getTitleElement(), false);
37481      }
37482      if (element.hasStatusElement()) {
37483        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
37484        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
37485      }
37486      if (element.hasExperimentalElement()) {
37487        composeBooleanCore("experimental", element.getExperimentalElement(), false);
37488        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
37489      }
37490      if (element.hasDateElement()) {
37491        composeDateTimeCore("date", element.getDateElement(), false);
37492        composeDateTimeExtras("date", element.getDateElement(), false);
37493      }
37494      if (element.hasPublisherElement()) {
37495        composeStringCore("publisher", element.getPublisherElement(), false);
37496        composeStringExtras("publisher", element.getPublisherElement(), false);
37497      }
37498      if (element.hasDescriptionElement()) {
37499        composeMarkdownCore("description", element.getDescriptionElement(), false);
37500        composeMarkdownExtras("description", element.getDescriptionElement(), false);
37501      }
37502      if (element.hasPurposeElement()) {
37503        composeMarkdownCore("purpose", element.getPurposeElement(), false);
37504        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
37505      }
37506      if (element.hasApprovalDateElement()) {
37507        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
37508        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
37509      }
37510      if (element.hasLastReviewDateElement()) {
37511        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
37512        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
37513      }
37514      if (element.hasEffectivePeriod()) {
37515        composePeriod("effectivePeriod", element.getEffectivePeriod());
37516      }
37517      if (element.hasUseContext()) {
37518        openArray("useContext");
37519        for (UsageContext e : element.getUseContext()) 
37520          composeUsageContext(null, e);
37521        closeArray();
37522      };
37523      if (element.hasJurisdiction()) {
37524        openArray("jurisdiction");
37525        for (CodeableConcept e : element.getJurisdiction()) 
37526          composeCodeableConcept(null, e);
37527        closeArray();
37528      };
37529      if (element.hasContact()) {
37530        openArray("contact");
37531        for (ContactDetail e : element.getContact()) 
37532          composeContactDetail(null, e);
37533        closeArray();
37534      };
37535      if (element.hasCopyrightElement()) {
37536        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
37537        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
37538      }
37539      if (element.hasCode()) {
37540        openArray("code");
37541        for (Coding e : element.getCode()) 
37542          composeCoding(null, e);
37543        closeArray();
37544      };
37545      if (element.hasSubjectType()) {
37546        openArray("subjectType");
37547        for (CodeType e : element.getSubjectType()) 
37548          composeCodeCore(null, e, true);
37549        closeArray();
37550        if (anyHasExtras(element.getSubjectType())) {
37551          openArray("_subjectType");
37552          for (CodeType e : element.getSubjectType()) 
37553            composeCodeExtras(null, e, true);
37554          closeArray();
37555        }
37556      };
37557      if (element.hasItem()) {
37558        openArray("item");
37559        for (Questionnaire.QuestionnaireItemComponent e : element.getItem()) 
37560          composeQuestionnaireQuestionnaireItemComponent(null, e);
37561        closeArray();
37562      };
37563  }
37564
37565  protected void composeQuestionnaireQuestionnaireItemComponent(String name, Questionnaire.QuestionnaireItemComponent element) throws IOException {
37566    if (element != null) {
37567      open(name);
37568      composeQuestionnaireQuestionnaireItemComponentInner(element);
37569      close();
37570    }
37571  }
37572
37573  protected void composeQuestionnaireQuestionnaireItemComponentInner(Questionnaire.QuestionnaireItemComponent element) throws IOException {
37574      composeBackbone(element);
37575      if (element.hasLinkIdElement()) {
37576        composeStringCore("linkId", element.getLinkIdElement(), false);
37577        composeStringExtras("linkId", element.getLinkIdElement(), false);
37578      }
37579      if (element.hasDefinitionElement()) {
37580        composeUriCore("definition", element.getDefinitionElement(), false);
37581        composeUriExtras("definition", element.getDefinitionElement(), false);
37582      }
37583      if (element.hasCode()) {
37584        openArray("code");
37585        for (Coding e : element.getCode()) 
37586          composeCoding(null, e);
37587        closeArray();
37588      };
37589      if (element.hasPrefixElement()) {
37590        composeStringCore("prefix", element.getPrefixElement(), false);
37591        composeStringExtras("prefix", element.getPrefixElement(), false);
37592      }
37593      if (element.hasTextElement()) {
37594        composeStringCore("text", element.getTextElement(), false);
37595        composeStringExtras("text", element.getTextElement(), false);
37596      }
37597      if (element.hasTypeElement()) {
37598        composeEnumerationCore("type", element.getTypeElement(), new Questionnaire.QuestionnaireItemTypeEnumFactory(), false);
37599        composeEnumerationExtras("type", element.getTypeElement(), new Questionnaire.QuestionnaireItemTypeEnumFactory(), false);
37600      }
37601      if (element.hasEnableWhen()) {
37602        openArray("enableWhen");
37603        for (Questionnaire.QuestionnaireItemEnableWhenComponent e : element.getEnableWhen()) 
37604          composeQuestionnaireQuestionnaireItemEnableWhenComponent(null, e);
37605        closeArray();
37606      };
37607      if (element.hasRequiredElement()) {
37608        composeBooleanCore("required", element.getRequiredElement(), false);
37609        composeBooleanExtras("required", element.getRequiredElement(), false);
37610      }
37611      if (element.hasRepeatsElement()) {
37612        composeBooleanCore("repeats", element.getRepeatsElement(), false);
37613        composeBooleanExtras("repeats", element.getRepeatsElement(), false);
37614      }
37615      if (element.hasReadOnlyElement()) {
37616        composeBooleanCore("readOnly", element.getReadOnlyElement(), false);
37617        composeBooleanExtras("readOnly", element.getReadOnlyElement(), false);
37618      }
37619      if (element.hasMaxLengthElement()) {
37620        composeIntegerCore("maxLength", element.getMaxLengthElement(), false);
37621        composeIntegerExtras("maxLength", element.getMaxLengthElement(), false);
37622      }
37623      if (element.hasOptions()) {
37624        composeReference("options", element.getOptions());
37625      }
37626      if (element.hasOption()) {
37627        openArray("option");
37628        for (Questionnaire.QuestionnaireItemOptionComponent e : element.getOption()) 
37629          composeQuestionnaireQuestionnaireItemOptionComponent(null, e);
37630        closeArray();
37631      };
37632      if (element.hasInitial()) {
37633        composeType("initial", element.getInitial());
37634      }
37635      if (element.hasItem()) {
37636        openArray("item");
37637        for (Questionnaire.QuestionnaireItemComponent e : element.getItem()) 
37638          composeQuestionnaireQuestionnaireItemComponent(null, e);
37639        closeArray();
37640      };
37641  }
37642
37643  protected void composeQuestionnaireQuestionnaireItemEnableWhenComponent(String name, Questionnaire.QuestionnaireItemEnableWhenComponent element) throws IOException {
37644    if (element != null) {
37645      open(name);
37646      composeQuestionnaireQuestionnaireItemEnableWhenComponentInner(element);
37647      close();
37648    }
37649  }
37650
37651  protected void composeQuestionnaireQuestionnaireItemEnableWhenComponentInner(Questionnaire.QuestionnaireItemEnableWhenComponent element) throws IOException {
37652      composeBackbone(element);
37653      if (element.hasQuestionElement()) {
37654        composeStringCore("question", element.getQuestionElement(), false);
37655        composeStringExtras("question", element.getQuestionElement(), false);
37656      }
37657      if (element.hasHasAnswerElement()) {
37658        composeBooleanCore("hasAnswer", element.getHasAnswerElement(), false);
37659        composeBooleanExtras("hasAnswer", element.getHasAnswerElement(), false);
37660      }
37661      if (element.hasAnswer()) {
37662        composeType("answer", element.getAnswer());
37663      }
37664  }
37665
37666  protected void composeQuestionnaireQuestionnaireItemOptionComponent(String name, Questionnaire.QuestionnaireItemOptionComponent element) throws IOException {
37667    if (element != null) {
37668      open(name);
37669      composeQuestionnaireQuestionnaireItemOptionComponentInner(element);
37670      close();
37671    }
37672  }
37673
37674  protected void composeQuestionnaireQuestionnaireItemOptionComponentInner(Questionnaire.QuestionnaireItemOptionComponent element) throws IOException {
37675      composeBackbone(element);
37676      if (element.hasValue()) {
37677        composeType("value", element.getValue());
37678      }
37679  }
37680
37681  protected void composeQuestionnaireResponse(String name, QuestionnaireResponse element) throws IOException {
37682    if (element != null) {
37683      prop("resourceType", name);
37684      composeQuestionnaireResponseInner(element);
37685    }
37686  }
37687
37688  protected void composeQuestionnaireResponseInner(QuestionnaireResponse element) throws IOException {
37689      composeDomainResourceElements(element);
37690      if (element.hasIdentifier()) {
37691        composeIdentifier("identifier", element.getIdentifier());
37692      }
37693      if (element.hasBasedOn()) {
37694        openArray("basedOn");
37695        for (Reference e : element.getBasedOn()) 
37696          composeReference(null, e);
37697        closeArray();
37698      };
37699      if (element.hasParent()) {
37700        openArray("parent");
37701        for (Reference e : element.getParent()) 
37702          composeReference(null, e);
37703        closeArray();
37704      };
37705      if (element.hasQuestionnaire()) {
37706        composeReference("questionnaire", element.getQuestionnaire());
37707      }
37708      if (element.hasStatusElement()) {
37709        composeEnumerationCore("status", element.getStatusElement(), new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory(), false);
37710        composeEnumerationExtras("status", element.getStatusElement(), new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory(), false);
37711      }
37712      if (element.hasSubject()) {
37713        composeReference("subject", element.getSubject());
37714      }
37715      if (element.hasContext()) {
37716        composeReference("context", element.getContext());
37717      }
37718      if (element.hasAuthoredElement()) {
37719        composeDateTimeCore("authored", element.getAuthoredElement(), false);
37720        composeDateTimeExtras("authored", element.getAuthoredElement(), false);
37721      }
37722      if (element.hasAuthor()) {
37723        composeReference("author", element.getAuthor());
37724      }
37725      if (element.hasSource()) {
37726        composeReference("source", element.getSource());
37727      }
37728      if (element.hasItem()) {
37729        openArray("item");
37730        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
37731          composeQuestionnaireResponseQuestionnaireResponseItemComponent(null, e);
37732        closeArray();
37733      };
37734  }
37735
37736  protected void composeQuestionnaireResponseQuestionnaireResponseItemComponent(String name, QuestionnaireResponse.QuestionnaireResponseItemComponent element) throws IOException {
37737    if (element != null) {
37738      open(name);
37739      composeQuestionnaireResponseQuestionnaireResponseItemComponentInner(element);
37740      close();
37741    }
37742  }
37743
37744  protected void composeQuestionnaireResponseQuestionnaireResponseItemComponentInner(QuestionnaireResponse.QuestionnaireResponseItemComponent element) throws IOException {
37745      composeBackbone(element);
37746      if (element.hasLinkIdElement()) {
37747        composeStringCore("linkId", element.getLinkIdElement(), false);
37748        composeStringExtras("linkId", element.getLinkIdElement(), false);
37749      }
37750      if (element.hasDefinitionElement()) {
37751        composeUriCore("definition", element.getDefinitionElement(), false);
37752        composeUriExtras("definition", element.getDefinitionElement(), false);
37753      }
37754      if (element.hasTextElement()) {
37755        composeStringCore("text", element.getTextElement(), false);
37756        composeStringExtras("text", element.getTextElement(), false);
37757      }
37758      if (element.hasSubject()) {
37759        composeReference("subject", element.getSubject());
37760      }
37761      if (element.hasAnswer()) {
37762        openArray("answer");
37763        for (QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent e : element.getAnswer()) 
37764          composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(null, e);
37765        closeArray();
37766      };
37767      if (element.hasItem()) {
37768        openArray("item");
37769        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
37770          composeQuestionnaireResponseQuestionnaireResponseItemComponent(null, e);
37771        closeArray();
37772      };
37773  }
37774
37775  protected void composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(String name, QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent element) throws IOException {
37776    if (element != null) {
37777      open(name);
37778      composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponentInner(element);
37779      close();
37780    }
37781  }
37782
37783  protected void composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponentInner(QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent element) throws IOException {
37784      composeBackbone(element);
37785      if (element.hasValue()) {
37786        composeType("value", element.getValue());
37787      }
37788      if (element.hasItem()) {
37789        openArray("item");
37790        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
37791          composeQuestionnaireResponseQuestionnaireResponseItemComponent(null, e);
37792        closeArray();
37793      };
37794  }
37795
37796  protected void composeReferralRequest(String name, ReferralRequest element) throws IOException {
37797    if (element != null) {
37798      prop("resourceType", name);
37799      composeReferralRequestInner(element);
37800    }
37801  }
37802
37803  protected void composeReferralRequestInner(ReferralRequest element) throws IOException {
37804      composeDomainResourceElements(element);
37805      if (element.hasIdentifier()) {
37806        openArray("identifier");
37807        for (Identifier e : element.getIdentifier()) 
37808          composeIdentifier(null, e);
37809        closeArray();
37810      };
37811      if (element.hasDefinition()) {
37812        openArray("definition");
37813        for (Reference e : element.getDefinition()) 
37814          composeReference(null, e);
37815        closeArray();
37816      };
37817      if (element.hasBasedOn()) {
37818        openArray("basedOn");
37819        for (Reference e : element.getBasedOn()) 
37820          composeReference(null, e);
37821        closeArray();
37822      };
37823      if (element.hasReplaces()) {
37824        openArray("replaces");
37825        for (Reference e : element.getReplaces()) 
37826          composeReference(null, e);
37827        closeArray();
37828      };
37829      if (element.hasGroupIdentifier()) {
37830        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
37831      }
37832      if (element.hasStatusElement()) {
37833        composeEnumerationCore("status", element.getStatusElement(), new ReferralRequest.ReferralRequestStatusEnumFactory(), false);
37834        composeEnumerationExtras("status", element.getStatusElement(), new ReferralRequest.ReferralRequestStatusEnumFactory(), false);
37835      }
37836      if (element.hasIntentElement()) {
37837        composeEnumerationCore("intent", element.getIntentElement(), new ReferralRequest.ReferralCategoryEnumFactory(), false);
37838        composeEnumerationExtras("intent", element.getIntentElement(), new ReferralRequest.ReferralCategoryEnumFactory(), false);
37839      }
37840      if (element.hasType()) {
37841        composeCodeableConcept("type", element.getType());
37842      }
37843      if (element.hasPriorityElement()) {
37844        composeEnumerationCore("priority", element.getPriorityElement(), new ReferralRequest.ReferralPriorityEnumFactory(), false);
37845        composeEnumerationExtras("priority", element.getPriorityElement(), new ReferralRequest.ReferralPriorityEnumFactory(), false);
37846      }
37847      if (element.hasServiceRequested()) {
37848        openArray("serviceRequested");
37849        for (CodeableConcept e : element.getServiceRequested()) 
37850          composeCodeableConcept(null, e);
37851        closeArray();
37852      };
37853      if (element.hasSubject()) {
37854        composeReference("subject", element.getSubject());
37855      }
37856      if (element.hasContext()) {
37857        composeReference("context", element.getContext());
37858      }
37859      if (element.hasOccurrence()) {
37860        composeType("occurrence", element.getOccurrence());
37861      }
37862      if (element.hasAuthoredOnElement()) {
37863        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
37864        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
37865      }
37866      if (element.hasRequester()) {
37867        composeReferralRequestReferralRequestRequesterComponent("requester", element.getRequester());
37868      }
37869      if (element.hasSpecialty()) {
37870        composeCodeableConcept("specialty", element.getSpecialty());
37871      }
37872      if (element.hasRecipient()) {
37873        openArray("recipient");
37874        for (Reference e : element.getRecipient()) 
37875          composeReference(null, e);
37876        closeArray();
37877      };
37878      if (element.hasReasonCode()) {
37879        openArray("reasonCode");
37880        for (CodeableConcept e : element.getReasonCode()) 
37881          composeCodeableConcept(null, e);
37882        closeArray();
37883      };
37884      if (element.hasReasonReference()) {
37885        openArray("reasonReference");
37886        for (Reference e : element.getReasonReference()) 
37887          composeReference(null, e);
37888        closeArray();
37889      };
37890      if (element.hasDescriptionElement()) {
37891        composeStringCore("description", element.getDescriptionElement(), false);
37892        composeStringExtras("description", element.getDescriptionElement(), false);
37893      }
37894      if (element.hasSupportingInfo()) {
37895        openArray("supportingInfo");
37896        for (Reference e : element.getSupportingInfo()) 
37897          composeReference(null, e);
37898        closeArray();
37899      };
37900      if (element.hasNote()) {
37901        openArray("note");
37902        for (Annotation e : element.getNote()) 
37903          composeAnnotation(null, e);
37904        closeArray();
37905      };
37906      if (element.hasRelevantHistory()) {
37907        openArray("relevantHistory");
37908        for (Reference e : element.getRelevantHistory()) 
37909          composeReference(null, e);
37910        closeArray();
37911      };
37912  }
37913
37914  protected void composeReferralRequestReferralRequestRequesterComponent(String name, ReferralRequest.ReferralRequestRequesterComponent element) throws IOException {
37915    if (element != null) {
37916      open(name);
37917      composeReferralRequestReferralRequestRequesterComponentInner(element);
37918      close();
37919    }
37920  }
37921
37922  protected void composeReferralRequestReferralRequestRequesterComponentInner(ReferralRequest.ReferralRequestRequesterComponent element) throws IOException {
37923      composeBackbone(element);
37924      if (element.hasAgent()) {
37925        composeReference("agent", element.getAgent());
37926      }
37927      if (element.hasOnBehalfOf()) {
37928        composeReference("onBehalfOf", element.getOnBehalfOf());
37929      }
37930  }
37931
37932  protected void composeRelatedPerson(String name, RelatedPerson element) throws IOException {
37933    if (element != null) {
37934      prop("resourceType", name);
37935      composeRelatedPersonInner(element);
37936    }
37937  }
37938
37939  protected void composeRelatedPersonInner(RelatedPerson element) throws IOException {
37940      composeDomainResourceElements(element);
37941      if (element.hasIdentifier()) {
37942        openArray("identifier");
37943        for (Identifier e : element.getIdentifier()) 
37944          composeIdentifier(null, e);
37945        closeArray();
37946      };
37947      if (element.hasActiveElement()) {
37948        composeBooleanCore("active", element.getActiveElement(), false);
37949        composeBooleanExtras("active", element.getActiveElement(), false);
37950      }
37951      if (element.hasPatient()) {
37952        composeReference("patient", element.getPatient());
37953      }
37954      if (element.hasRelationship()) {
37955        composeCodeableConcept("relationship", element.getRelationship());
37956      }
37957      if (element.hasName()) {
37958        openArray("name");
37959        for (HumanName e : element.getName()) 
37960          composeHumanName(null, e);
37961        closeArray();
37962      };
37963      if (element.hasTelecom()) {
37964        openArray("telecom");
37965        for (ContactPoint e : element.getTelecom()) 
37966          composeContactPoint(null, e);
37967        closeArray();
37968      };
37969      if (element.hasGenderElement()) {
37970        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
37971        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
37972      }
37973      if (element.hasBirthDateElement()) {
37974        composeDateCore("birthDate", element.getBirthDateElement(), false);
37975        composeDateExtras("birthDate", element.getBirthDateElement(), false);
37976      }
37977      if (element.hasAddress()) {
37978        openArray("address");
37979        for (Address e : element.getAddress()) 
37980          composeAddress(null, e);
37981        closeArray();
37982      };
37983      if (element.hasPhoto()) {
37984        openArray("photo");
37985        for (Attachment e : element.getPhoto()) 
37986          composeAttachment(null, e);
37987        closeArray();
37988      };
37989      if (element.hasPeriod()) {
37990        composePeriod("period", element.getPeriod());
37991      }
37992  }
37993
37994  protected void composeRequestGroup(String name, RequestGroup element) throws IOException {
37995    if (element != null) {
37996      prop("resourceType", name);
37997      composeRequestGroupInner(element);
37998    }
37999  }
38000
38001  protected void composeRequestGroupInner(RequestGroup element) throws IOException {
38002      composeDomainResourceElements(element);
38003      if (element.hasIdentifier()) {
38004        openArray("identifier");
38005        for (Identifier e : element.getIdentifier()) 
38006          composeIdentifier(null, e);
38007        closeArray();
38008      };
38009      if (element.hasDefinition()) {
38010        openArray("definition");
38011        for (Reference e : element.getDefinition()) 
38012          composeReference(null, e);
38013        closeArray();
38014      };
38015      if (element.hasBasedOn()) {
38016        openArray("basedOn");
38017        for (Reference e : element.getBasedOn()) 
38018          composeReference(null, e);
38019        closeArray();
38020      };
38021      if (element.hasReplaces()) {
38022        openArray("replaces");
38023        for (Reference e : element.getReplaces()) 
38024          composeReference(null, e);
38025        closeArray();
38026      };
38027      if (element.hasGroupIdentifier()) {
38028        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
38029      }
38030      if (element.hasStatusElement()) {
38031        composeEnumerationCore("status", element.getStatusElement(), new RequestGroup.RequestStatusEnumFactory(), false);
38032        composeEnumerationExtras("status", element.getStatusElement(), new RequestGroup.RequestStatusEnumFactory(), false);
38033      }
38034      if (element.hasIntentElement()) {
38035        composeEnumerationCore("intent", element.getIntentElement(), new RequestGroup.RequestIntentEnumFactory(), false);
38036        composeEnumerationExtras("intent", element.getIntentElement(), new RequestGroup.RequestIntentEnumFactory(), false);
38037      }
38038      if (element.hasPriorityElement()) {
38039        composeEnumerationCore("priority", element.getPriorityElement(), new RequestGroup.RequestPriorityEnumFactory(), false);
38040        composeEnumerationExtras("priority", element.getPriorityElement(), new RequestGroup.RequestPriorityEnumFactory(), false);
38041      }
38042      if (element.hasSubject()) {
38043        composeReference("subject", element.getSubject());
38044      }
38045      if (element.hasContext()) {
38046        composeReference("context", element.getContext());
38047      }
38048      if (element.hasAuthoredOnElement()) {
38049        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
38050        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
38051      }
38052      if (element.hasAuthor()) {
38053        composeReference("author", element.getAuthor());
38054      }
38055      if (element.hasReason()) {
38056        composeType("reason", element.getReason());
38057      }
38058      if (element.hasNote()) {
38059        openArray("note");
38060        for (Annotation e : element.getNote()) 
38061          composeAnnotation(null, e);
38062        closeArray();
38063      };
38064      if (element.hasAction()) {
38065        openArray("action");
38066        for (RequestGroup.RequestGroupActionComponent e : element.getAction()) 
38067          composeRequestGroupRequestGroupActionComponent(null, e);
38068        closeArray();
38069      };
38070  }
38071
38072  protected void composeRequestGroupRequestGroupActionComponent(String name, RequestGroup.RequestGroupActionComponent element) throws IOException {
38073    if (element != null) {
38074      open(name);
38075      composeRequestGroupRequestGroupActionComponentInner(element);
38076      close();
38077    }
38078  }
38079
38080  protected void composeRequestGroupRequestGroupActionComponentInner(RequestGroup.RequestGroupActionComponent element) throws IOException {
38081      composeBackbone(element);
38082      if (element.hasLabelElement()) {
38083        composeStringCore("label", element.getLabelElement(), false);
38084        composeStringExtras("label", element.getLabelElement(), false);
38085      }
38086      if (element.hasTitleElement()) {
38087        composeStringCore("title", element.getTitleElement(), false);
38088        composeStringExtras("title", element.getTitleElement(), false);
38089      }
38090      if (element.hasDescriptionElement()) {
38091        composeStringCore("description", element.getDescriptionElement(), false);
38092        composeStringExtras("description", element.getDescriptionElement(), false);
38093      }
38094      if (element.hasTextEquivalentElement()) {
38095        composeStringCore("textEquivalent", element.getTextEquivalentElement(), false);
38096        composeStringExtras("textEquivalent", element.getTextEquivalentElement(), false);
38097      }
38098      if (element.hasCode()) {
38099        openArray("code");
38100        for (CodeableConcept e : element.getCode()) 
38101          composeCodeableConcept(null, e);
38102        closeArray();
38103      };
38104      if (element.hasDocumentation()) {
38105        openArray("documentation");
38106        for (RelatedArtifact e : element.getDocumentation()) 
38107          composeRelatedArtifact(null, e);
38108        closeArray();
38109      };
38110      if (element.hasCondition()) {
38111        openArray("condition");
38112        for (RequestGroup.RequestGroupActionConditionComponent e : element.getCondition()) 
38113          composeRequestGroupRequestGroupActionConditionComponent(null, e);
38114        closeArray();
38115      };
38116      if (element.hasRelatedAction()) {
38117        openArray("relatedAction");
38118        for (RequestGroup.RequestGroupActionRelatedActionComponent e : element.getRelatedAction()) 
38119          composeRequestGroupRequestGroupActionRelatedActionComponent(null, e);
38120        closeArray();
38121      };
38122      if (element.hasTiming()) {
38123        composeType("timing", element.getTiming());
38124      }
38125      if (element.hasParticipant()) {
38126        openArray("participant");
38127        for (Reference e : element.getParticipant()) 
38128          composeReference(null, e);
38129        closeArray();
38130      };
38131      if (element.hasType()) {
38132        composeCoding("type", element.getType());
38133      }
38134      if (element.hasGroupingBehaviorElement()) {
38135        composeEnumerationCore("groupingBehavior", element.getGroupingBehaviorElement(), new RequestGroup.ActionGroupingBehaviorEnumFactory(), false);
38136        composeEnumerationExtras("groupingBehavior", element.getGroupingBehaviorElement(), new RequestGroup.ActionGroupingBehaviorEnumFactory(), false);
38137      }
38138      if (element.hasSelectionBehaviorElement()) {
38139        composeEnumerationCore("selectionBehavior", element.getSelectionBehaviorElement(), new RequestGroup.ActionSelectionBehaviorEnumFactory(), false);
38140        composeEnumerationExtras("selectionBehavior", element.getSelectionBehaviorElement(), new RequestGroup.ActionSelectionBehaviorEnumFactory(), false);
38141      }
38142      if (element.hasRequiredBehaviorElement()) {
38143        composeEnumerationCore("requiredBehavior", element.getRequiredBehaviorElement(), new RequestGroup.ActionRequiredBehaviorEnumFactory(), false);
38144        composeEnumerationExtras("requiredBehavior", element.getRequiredBehaviorElement(), new RequestGroup.ActionRequiredBehaviorEnumFactory(), false);
38145      }
38146      if (element.hasPrecheckBehaviorElement()) {
38147        composeEnumerationCore("precheckBehavior", element.getPrecheckBehaviorElement(), new RequestGroup.ActionPrecheckBehaviorEnumFactory(), false);
38148        composeEnumerationExtras("precheckBehavior", element.getPrecheckBehaviorElement(), new RequestGroup.ActionPrecheckBehaviorEnumFactory(), false);
38149      }
38150      if (element.hasCardinalityBehaviorElement()) {
38151        composeEnumerationCore("cardinalityBehavior", element.getCardinalityBehaviorElement(), new RequestGroup.ActionCardinalityBehaviorEnumFactory(), false);
38152        composeEnumerationExtras("cardinalityBehavior", element.getCardinalityBehaviorElement(), new RequestGroup.ActionCardinalityBehaviorEnumFactory(), false);
38153      }
38154      if (element.hasResource()) {
38155        composeReference("resource", element.getResource());
38156      }
38157      if (element.hasAction()) {
38158        openArray("action");
38159        for (RequestGroup.RequestGroupActionComponent e : element.getAction()) 
38160          composeRequestGroupRequestGroupActionComponent(null, e);
38161        closeArray();
38162      };
38163  }
38164
38165  protected void composeRequestGroupRequestGroupActionConditionComponent(String name, RequestGroup.RequestGroupActionConditionComponent element) throws IOException {
38166    if (element != null) {
38167      open(name);
38168      composeRequestGroupRequestGroupActionConditionComponentInner(element);
38169      close();
38170    }
38171  }
38172
38173  protected void composeRequestGroupRequestGroupActionConditionComponentInner(RequestGroup.RequestGroupActionConditionComponent element) throws IOException {
38174      composeBackbone(element);
38175      if (element.hasKindElement()) {
38176        composeEnumerationCore("kind", element.getKindElement(), new RequestGroup.ActionConditionKindEnumFactory(), false);
38177        composeEnumerationExtras("kind", element.getKindElement(), new RequestGroup.ActionConditionKindEnumFactory(), false);
38178      }
38179      if (element.hasDescriptionElement()) {
38180        composeStringCore("description", element.getDescriptionElement(), false);
38181        composeStringExtras("description", element.getDescriptionElement(), false);
38182      }
38183      if (element.hasLanguageElement()) {
38184        composeStringCore("language", element.getLanguageElement(), false);
38185        composeStringExtras("language", element.getLanguageElement(), false);
38186      }
38187      if (element.hasExpressionElement()) {
38188        composeStringCore("expression", element.getExpressionElement(), false);
38189        composeStringExtras("expression", element.getExpressionElement(), false);
38190      }
38191  }
38192
38193  protected void composeRequestGroupRequestGroupActionRelatedActionComponent(String name, RequestGroup.RequestGroupActionRelatedActionComponent element) throws IOException {
38194    if (element != null) {
38195      open(name);
38196      composeRequestGroupRequestGroupActionRelatedActionComponentInner(element);
38197      close();
38198    }
38199  }
38200
38201  protected void composeRequestGroupRequestGroupActionRelatedActionComponentInner(RequestGroup.RequestGroupActionRelatedActionComponent element) throws IOException {
38202      composeBackbone(element);
38203      if (element.hasActionIdElement()) {
38204        composeIdCore("actionId", element.getActionIdElement(), false);
38205        composeIdExtras("actionId", element.getActionIdElement(), false);
38206      }
38207      if (element.hasRelationshipElement()) {
38208        composeEnumerationCore("relationship", element.getRelationshipElement(), new RequestGroup.ActionRelationshipTypeEnumFactory(), false);
38209        composeEnumerationExtras("relationship", element.getRelationshipElement(), new RequestGroup.ActionRelationshipTypeEnumFactory(), false);
38210      }
38211      if (element.hasOffset()) {
38212        composeType("offset", element.getOffset());
38213      }
38214  }
38215
38216  protected void composeResearchStudy(String name, ResearchStudy element) throws IOException {
38217    if (element != null) {
38218      prop("resourceType", name);
38219      composeResearchStudyInner(element);
38220    }
38221  }
38222
38223  protected void composeResearchStudyInner(ResearchStudy element) throws IOException {
38224      composeDomainResourceElements(element);
38225      if (element.hasIdentifier()) {
38226        openArray("identifier");
38227        for (Identifier e : element.getIdentifier()) 
38228          composeIdentifier(null, e);
38229        closeArray();
38230      };
38231      if (element.hasTitleElement()) {
38232        composeStringCore("title", element.getTitleElement(), false);
38233        composeStringExtras("title", element.getTitleElement(), false);
38234      }
38235      if (element.hasProtocol()) {
38236        openArray("protocol");
38237        for (Reference e : element.getProtocol()) 
38238          composeReference(null, e);
38239        closeArray();
38240      };
38241      if (element.hasPartOf()) {
38242        openArray("partOf");
38243        for (Reference e : element.getPartOf()) 
38244          composeReference(null, e);
38245        closeArray();
38246      };
38247      if (element.hasStatusElement()) {
38248        composeEnumerationCore("status", element.getStatusElement(), new ResearchStudy.ResearchStudyStatusEnumFactory(), false);
38249        composeEnumerationExtras("status", element.getStatusElement(), new ResearchStudy.ResearchStudyStatusEnumFactory(), false);
38250      }
38251      if (element.hasCategory()) {
38252        openArray("category");
38253        for (CodeableConcept e : element.getCategory()) 
38254          composeCodeableConcept(null, e);
38255        closeArray();
38256      };
38257      if (element.hasFocus()) {
38258        openArray("focus");
38259        for (CodeableConcept e : element.getFocus()) 
38260          composeCodeableConcept(null, e);
38261        closeArray();
38262      };
38263      if (element.hasContact()) {
38264        openArray("contact");
38265        for (ContactDetail e : element.getContact()) 
38266          composeContactDetail(null, e);
38267        closeArray();
38268      };
38269      if (element.hasRelatedArtifact()) {
38270        openArray("relatedArtifact");
38271        for (RelatedArtifact e : element.getRelatedArtifact()) 
38272          composeRelatedArtifact(null, e);
38273        closeArray();
38274      };
38275      if (element.hasKeyword()) {
38276        openArray("keyword");
38277        for (CodeableConcept e : element.getKeyword()) 
38278          composeCodeableConcept(null, e);
38279        closeArray();
38280      };
38281      if (element.hasJurisdiction()) {
38282        openArray("jurisdiction");
38283        for (CodeableConcept e : element.getJurisdiction()) 
38284          composeCodeableConcept(null, e);
38285        closeArray();
38286      };
38287      if (element.hasDescriptionElement()) {
38288        composeMarkdownCore("description", element.getDescriptionElement(), false);
38289        composeMarkdownExtras("description", element.getDescriptionElement(), false);
38290      }
38291      if (element.hasEnrollment()) {
38292        openArray("enrollment");
38293        for (Reference e : element.getEnrollment()) 
38294          composeReference(null, e);
38295        closeArray();
38296      };
38297      if (element.hasPeriod()) {
38298        composePeriod("period", element.getPeriod());
38299      }
38300      if (element.hasSponsor()) {
38301        composeReference("sponsor", element.getSponsor());
38302      }
38303      if (element.hasPrincipalInvestigator()) {
38304        composeReference("principalInvestigator", element.getPrincipalInvestigator());
38305      }
38306      if (element.hasSite()) {
38307        openArray("site");
38308        for (Reference e : element.getSite()) 
38309          composeReference(null, e);
38310        closeArray();
38311      };
38312      if (element.hasReasonStopped()) {
38313        composeCodeableConcept("reasonStopped", element.getReasonStopped());
38314      }
38315      if (element.hasNote()) {
38316        openArray("note");
38317        for (Annotation e : element.getNote()) 
38318          composeAnnotation(null, e);
38319        closeArray();
38320      };
38321      if (element.hasArm()) {
38322        openArray("arm");
38323        for (ResearchStudy.ResearchStudyArmComponent e : element.getArm()) 
38324          composeResearchStudyResearchStudyArmComponent(null, e);
38325        closeArray();
38326      };
38327  }
38328
38329  protected void composeResearchStudyResearchStudyArmComponent(String name, ResearchStudy.ResearchStudyArmComponent element) throws IOException {
38330    if (element != null) {
38331      open(name);
38332      composeResearchStudyResearchStudyArmComponentInner(element);
38333      close();
38334    }
38335  }
38336
38337  protected void composeResearchStudyResearchStudyArmComponentInner(ResearchStudy.ResearchStudyArmComponent element) throws IOException {
38338      composeBackbone(element);
38339      if (element.hasNameElement()) {
38340        composeStringCore("name", element.getNameElement(), false);
38341        composeStringExtras("name", element.getNameElement(), false);
38342      }
38343      if (element.hasCode()) {
38344        composeCodeableConcept("code", element.getCode());
38345      }
38346      if (element.hasDescriptionElement()) {
38347        composeStringCore("description", element.getDescriptionElement(), false);
38348        composeStringExtras("description", element.getDescriptionElement(), false);
38349      }
38350  }
38351
38352  protected void composeResearchSubject(String name, ResearchSubject element) throws IOException {
38353    if (element != null) {
38354      prop("resourceType", name);
38355      composeResearchSubjectInner(element);
38356    }
38357  }
38358
38359  protected void composeResearchSubjectInner(ResearchSubject element) throws IOException {
38360      composeDomainResourceElements(element);
38361      if (element.hasIdentifier()) {
38362        composeIdentifier("identifier", element.getIdentifier());
38363      }
38364      if (element.hasStatusElement()) {
38365        composeEnumerationCore("status", element.getStatusElement(), new ResearchSubject.ResearchSubjectStatusEnumFactory(), false);
38366        composeEnumerationExtras("status", element.getStatusElement(), new ResearchSubject.ResearchSubjectStatusEnumFactory(), false);
38367      }
38368      if (element.hasPeriod()) {
38369        composePeriod("period", element.getPeriod());
38370      }
38371      if (element.hasStudy()) {
38372        composeReference("study", element.getStudy());
38373      }
38374      if (element.hasIndividual()) {
38375        composeReference("individual", element.getIndividual());
38376      }
38377      if (element.hasAssignedArmElement()) {
38378        composeStringCore("assignedArm", element.getAssignedArmElement(), false);
38379        composeStringExtras("assignedArm", element.getAssignedArmElement(), false);
38380      }
38381      if (element.hasActualArmElement()) {
38382        composeStringCore("actualArm", element.getActualArmElement(), false);
38383        composeStringExtras("actualArm", element.getActualArmElement(), false);
38384      }
38385      if (element.hasConsent()) {
38386        composeReference("consent", element.getConsent());
38387      }
38388  }
38389
38390  protected void composeRiskAssessment(String name, RiskAssessment element) throws IOException {
38391    if (element != null) {
38392      prop("resourceType", name);
38393      composeRiskAssessmentInner(element);
38394    }
38395  }
38396
38397  protected void composeRiskAssessmentInner(RiskAssessment element) throws IOException {
38398      composeDomainResourceElements(element);
38399      if (element.hasIdentifier()) {
38400        composeIdentifier("identifier", element.getIdentifier());
38401      }
38402      if (element.hasBasedOn()) {
38403        composeReference("basedOn", element.getBasedOn());
38404      }
38405      if (element.hasParent()) {
38406        composeReference("parent", element.getParent());
38407      }
38408      if (element.hasStatusElement()) {
38409        composeEnumerationCore("status", element.getStatusElement(), new RiskAssessment.RiskAssessmentStatusEnumFactory(), false);
38410        composeEnumerationExtras("status", element.getStatusElement(), new RiskAssessment.RiskAssessmentStatusEnumFactory(), false);
38411      }
38412      if (element.hasMethod()) {
38413        composeCodeableConcept("method", element.getMethod());
38414      }
38415      if (element.hasCode()) {
38416        composeCodeableConcept("code", element.getCode());
38417      }
38418      if (element.hasSubject()) {
38419        composeReference("subject", element.getSubject());
38420      }
38421      if (element.hasContext()) {
38422        composeReference("context", element.getContext());
38423      }
38424      if (element.hasOccurrence()) {
38425        composeType("occurrence", element.getOccurrence());
38426      }
38427      if (element.hasCondition()) {
38428        composeReference("condition", element.getCondition());
38429      }
38430      if (element.hasPerformer()) {
38431        composeReference("performer", element.getPerformer());
38432      }
38433      if (element.hasReason()) {
38434        composeType("reason", element.getReason());
38435      }
38436      if (element.hasBasis()) {
38437        openArray("basis");
38438        for (Reference e : element.getBasis()) 
38439          composeReference(null, e);
38440        closeArray();
38441      };
38442      if (element.hasPrediction()) {
38443        openArray("prediction");
38444        for (RiskAssessment.RiskAssessmentPredictionComponent e : element.getPrediction()) 
38445          composeRiskAssessmentRiskAssessmentPredictionComponent(null, e);
38446        closeArray();
38447      };
38448      if (element.hasMitigationElement()) {
38449        composeStringCore("mitigation", element.getMitigationElement(), false);
38450        composeStringExtras("mitigation", element.getMitigationElement(), false);
38451      }
38452      if (element.hasCommentElement()) {
38453        composeStringCore("comment", element.getCommentElement(), false);
38454        composeStringExtras("comment", element.getCommentElement(), false);
38455      }
38456  }
38457
38458  protected void composeRiskAssessmentRiskAssessmentPredictionComponent(String name, RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
38459    if (element != null) {
38460      open(name);
38461      composeRiskAssessmentRiskAssessmentPredictionComponentInner(element);
38462      close();
38463    }
38464  }
38465
38466  protected void composeRiskAssessmentRiskAssessmentPredictionComponentInner(RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
38467      composeBackbone(element);
38468      if (element.hasOutcome()) {
38469        composeCodeableConcept("outcome", element.getOutcome());
38470      }
38471      if (element.hasProbability()) {
38472        composeType("probability", element.getProbability());
38473      }
38474      if (element.hasQualitativeRisk()) {
38475        composeCodeableConcept("qualitativeRisk", element.getQualitativeRisk());
38476      }
38477      if (element.hasRelativeRiskElement()) {
38478        composeDecimalCore("relativeRisk", element.getRelativeRiskElement(), false);
38479        composeDecimalExtras("relativeRisk", element.getRelativeRiskElement(), false);
38480      }
38481      if (element.hasWhen()) {
38482        composeType("when", element.getWhen());
38483      }
38484      if (element.hasRationaleElement()) {
38485        composeStringCore("rationale", element.getRationaleElement(), false);
38486        composeStringExtras("rationale", element.getRationaleElement(), false);
38487      }
38488  }
38489
38490  protected void composeSchedule(String name, Schedule element) throws IOException {
38491    if (element != null) {
38492      prop("resourceType", name);
38493      composeScheduleInner(element);
38494    }
38495  }
38496
38497  protected void composeScheduleInner(Schedule element) throws IOException {
38498      composeDomainResourceElements(element);
38499      if (element.hasIdentifier()) {
38500        openArray("identifier");
38501        for (Identifier e : element.getIdentifier()) 
38502          composeIdentifier(null, e);
38503        closeArray();
38504      };
38505      if (element.hasActiveElement()) {
38506        composeBooleanCore("active", element.getActiveElement(), false);
38507        composeBooleanExtras("active", element.getActiveElement(), false);
38508      }
38509      if (element.hasServiceCategory()) {
38510        composeCodeableConcept("serviceCategory", element.getServiceCategory());
38511      }
38512      if (element.hasServiceType()) {
38513        openArray("serviceType");
38514        for (CodeableConcept e : element.getServiceType()) 
38515          composeCodeableConcept(null, e);
38516        closeArray();
38517      };
38518      if (element.hasSpecialty()) {
38519        openArray("specialty");
38520        for (CodeableConcept e : element.getSpecialty()) 
38521          composeCodeableConcept(null, e);
38522        closeArray();
38523      };
38524      if (element.hasActor()) {
38525        openArray("actor");
38526        for (Reference e : element.getActor()) 
38527          composeReference(null, e);
38528        closeArray();
38529      };
38530      if (element.hasPlanningHorizon()) {
38531        composePeriod("planningHorizon", element.getPlanningHorizon());
38532      }
38533      if (element.hasCommentElement()) {
38534        composeStringCore("comment", element.getCommentElement(), false);
38535        composeStringExtras("comment", element.getCommentElement(), false);
38536      }
38537  }
38538
38539  protected void composeSearchParameter(String name, SearchParameter element) throws IOException {
38540    if (element != null) {
38541      prop("resourceType", name);
38542      composeSearchParameterInner(element);
38543    }
38544  }
38545
38546  protected void composeSearchParameterInner(SearchParameter element) throws IOException {
38547      composeDomainResourceElements(element);
38548      if (element.hasUrlElement()) {
38549        composeUriCore("url", element.getUrlElement(), false);
38550        composeUriExtras("url", element.getUrlElement(), false);
38551      }
38552      if (element.hasVersionElement()) {
38553        composeStringCore("version", element.getVersionElement(), false);
38554        composeStringExtras("version", element.getVersionElement(), false);
38555      }
38556      if (element.hasNameElement()) {
38557        composeStringCore("name", element.getNameElement(), false);
38558        composeStringExtras("name", element.getNameElement(), false);
38559      }
38560      if (element.hasStatusElement()) {
38561        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
38562        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
38563      }
38564      if (element.hasExperimentalElement()) {
38565        composeBooleanCore("experimental", element.getExperimentalElement(), false);
38566        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
38567      }
38568      if (element.hasDateElement()) {
38569        composeDateTimeCore("date", element.getDateElement(), false);
38570        composeDateTimeExtras("date", element.getDateElement(), false);
38571      }
38572      if (element.hasPublisherElement()) {
38573        composeStringCore("publisher", element.getPublisherElement(), false);
38574        composeStringExtras("publisher", element.getPublisherElement(), false);
38575      }
38576      if (element.hasContact()) {
38577        openArray("contact");
38578        for (ContactDetail e : element.getContact()) 
38579          composeContactDetail(null, e);
38580        closeArray();
38581      };
38582      if (element.hasUseContext()) {
38583        openArray("useContext");
38584        for (UsageContext e : element.getUseContext()) 
38585          composeUsageContext(null, e);
38586        closeArray();
38587      };
38588      if (element.hasJurisdiction()) {
38589        openArray("jurisdiction");
38590        for (CodeableConcept e : element.getJurisdiction()) 
38591          composeCodeableConcept(null, e);
38592        closeArray();
38593      };
38594      if (element.hasPurposeElement()) {
38595        composeMarkdownCore("purpose", element.getPurposeElement(), false);
38596        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
38597      }
38598      if (element.hasCodeElement()) {
38599        composeCodeCore("code", element.getCodeElement(), false);
38600        composeCodeExtras("code", element.getCodeElement(), false);
38601      }
38602      if (element.hasBase()) {
38603        openArray("base");
38604        for (CodeType e : element.getBase()) 
38605          composeCodeCore(null, e, true);
38606        closeArray();
38607        if (anyHasExtras(element.getBase())) {
38608          openArray("_base");
38609          for (CodeType e : element.getBase()) 
38610            composeCodeExtras(null, e, true);
38611          closeArray();
38612        }
38613      };
38614      if (element.hasTypeElement()) {
38615        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
38616        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
38617      }
38618      if (element.hasDerivedFromElement()) {
38619        composeUriCore("derivedFrom", element.getDerivedFromElement(), false);
38620        composeUriExtras("derivedFrom", element.getDerivedFromElement(), false);
38621      }
38622      if (element.hasDescriptionElement()) {
38623        composeMarkdownCore("description", element.getDescriptionElement(), false);
38624        composeMarkdownExtras("description", element.getDescriptionElement(), false);
38625      }
38626      if (element.hasExpressionElement()) {
38627        composeStringCore("expression", element.getExpressionElement(), false);
38628        composeStringExtras("expression", element.getExpressionElement(), false);
38629      }
38630      if (element.hasXpathElement()) {
38631        composeStringCore("xpath", element.getXpathElement(), false);
38632        composeStringExtras("xpath", element.getXpathElement(), false);
38633      }
38634      if (element.hasXpathUsageElement()) {
38635        composeEnumerationCore("xpathUsage", element.getXpathUsageElement(), new SearchParameter.XPathUsageTypeEnumFactory(), false);
38636        composeEnumerationExtras("xpathUsage", element.getXpathUsageElement(), new SearchParameter.XPathUsageTypeEnumFactory(), false);
38637      }
38638      if (element.hasTarget()) {
38639        openArray("target");
38640        for (CodeType e : element.getTarget()) 
38641          composeCodeCore(null, e, true);
38642        closeArray();
38643        if (anyHasExtras(element.getTarget())) {
38644          openArray("_target");
38645          for (CodeType e : element.getTarget()) 
38646            composeCodeExtras(null, e, true);
38647          closeArray();
38648        }
38649      };
38650      if (element.hasComparator()) {
38651        openArray("comparator");
38652        for (Enumeration<SearchParameter.SearchComparator> e : element.getComparator()) 
38653          composeEnumerationCore(null, e, new SearchParameter.SearchComparatorEnumFactory(), true);
38654        closeArray();
38655        if (anyHasExtras(element.getComparator())) {
38656          openArray("_comparator");
38657          for (Enumeration<SearchParameter.SearchComparator> e : element.getComparator()) 
38658            composeEnumerationExtras(null, e, new SearchParameter.SearchComparatorEnumFactory(), true);
38659          closeArray();
38660        }
38661      };
38662      if (element.hasModifier()) {
38663        openArray("modifier");
38664        for (Enumeration<SearchParameter.SearchModifierCode> e : element.getModifier()) 
38665          composeEnumerationCore(null, e, new SearchParameter.SearchModifierCodeEnumFactory(), true);
38666        closeArray();
38667        if (anyHasExtras(element.getModifier())) {
38668          openArray("_modifier");
38669          for (Enumeration<SearchParameter.SearchModifierCode> e : element.getModifier()) 
38670            composeEnumerationExtras(null, e, new SearchParameter.SearchModifierCodeEnumFactory(), true);
38671          closeArray();
38672        }
38673      };
38674      if (element.hasChain()) {
38675        openArray("chain");
38676        for (StringType e : element.getChain()) 
38677          composeStringCore(null, e, true);
38678        closeArray();
38679        if (anyHasExtras(element.getChain())) {
38680          openArray("_chain");
38681          for (StringType e : element.getChain()) 
38682            composeStringExtras(null, e, true);
38683          closeArray();
38684        }
38685      };
38686      if (element.hasComponent()) {
38687        openArray("component");
38688        for (SearchParameter.SearchParameterComponentComponent e : element.getComponent()) 
38689          composeSearchParameterSearchParameterComponentComponent(null, e);
38690        closeArray();
38691      };
38692  }
38693
38694  protected void composeSearchParameterSearchParameterComponentComponent(String name, SearchParameter.SearchParameterComponentComponent element) throws IOException {
38695    if (element != null) {
38696      open(name);
38697      composeSearchParameterSearchParameterComponentComponentInner(element);
38698      close();
38699    }
38700  }
38701
38702  protected void composeSearchParameterSearchParameterComponentComponentInner(SearchParameter.SearchParameterComponentComponent element) throws IOException {
38703      composeBackbone(element);
38704      if (element.hasDefinition()) {
38705        composeReference("definition", element.getDefinition());
38706      }
38707      if (element.hasExpressionElement()) {
38708        composeStringCore("expression", element.getExpressionElement(), false);
38709        composeStringExtras("expression", element.getExpressionElement(), false);
38710      }
38711  }
38712
38713  protected void composeSequence(String name, Sequence element) throws IOException {
38714    if (element != null) {
38715      prop("resourceType", name);
38716      composeSequenceInner(element);
38717    }
38718  }
38719
38720  protected void composeSequenceInner(Sequence element) throws IOException {
38721      composeDomainResourceElements(element);
38722      if (element.hasIdentifier()) {
38723        openArray("identifier");
38724        for (Identifier e : element.getIdentifier()) 
38725          composeIdentifier(null, e);
38726        closeArray();
38727      };
38728      if (element.hasTypeElement()) {
38729        composeEnumerationCore("type", element.getTypeElement(), new Sequence.SequenceTypeEnumFactory(), false);
38730        composeEnumerationExtras("type", element.getTypeElement(), new Sequence.SequenceTypeEnumFactory(), false);
38731      }
38732      if (element.hasCoordinateSystemElement()) {
38733        composeIntegerCore("coordinateSystem", element.getCoordinateSystemElement(), false);
38734        composeIntegerExtras("coordinateSystem", element.getCoordinateSystemElement(), false);
38735      }
38736      if (element.hasPatient()) {
38737        composeReference("patient", element.getPatient());
38738      }
38739      if (element.hasSpecimen()) {
38740        composeReference("specimen", element.getSpecimen());
38741      }
38742      if (element.hasDevice()) {
38743        composeReference("device", element.getDevice());
38744      }
38745      if (element.hasPerformer()) {
38746        composeReference("performer", element.getPerformer());
38747      }
38748      if (element.hasQuantity()) {
38749        composeQuantity("quantity", element.getQuantity());
38750      }
38751      if (element.hasReferenceSeq()) {
38752        composeSequenceSequenceReferenceSeqComponent("referenceSeq", element.getReferenceSeq());
38753      }
38754      if (element.hasVariant()) {
38755        openArray("variant");
38756        for (Sequence.SequenceVariantComponent e : element.getVariant()) 
38757          composeSequenceSequenceVariantComponent(null, e);
38758        closeArray();
38759      };
38760      if (element.hasObservedSeqElement()) {
38761        composeStringCore("observedSeq", element.getObservedSeqElement(), false);
38762        composeStringExtras("observedSeq", element.getObservedSeqElement(), false);
38763      }
38764      if (element.hasQuality()) {
38765        openArray("quality");
38766        for (Sequence.SequenceQualityComponent e : element.getQuality()) 
38767          composeSequenceSequenceQualityComponent(null, e);
38768        closeArray();
38769      };
38770      if (element.hasReadCoverageElement()) {
38771        composeIntegerCore("readCoverage", element.getReadCoverageElement(), false);
38772        composeIntegerExtras("readCoverage", element.getReadCoverageElement(), false);
38773      }
38774      if (element.hasRepository()) {
38775        openArray("repository");
38776        for (Sequence.SequenceRepositoryComponent e : element.getRepository()) 
38777          composeSequenceSequenceRepositoryComponent(null, e);
38778        closeArray();
38779      };
38780      if (element.hasPointer()) {
38781        openArray("pointer");
38782        for (Reference e : element.getPointer()) 
38783          composeReference(null, e);
38784        closeArray();
38785      };
38786  }
38787
38788  protected void composeSequenceSequenceReferenceSeqComponent(String name, Sequence.SequenceReferenceSeqComponent element) throws IOException {
38789    if (element != null) {
38790      open(name);
38791      composeSequenceSequenceReferenceSeqComponentInner(element);
38792      close();
38793    }
38794  }
38795
38796  protected void composeSequenceSequenceReferenceSeqComponentInner(Sequence.SequenceReferenceSeqComponent element) throws IOException {
38797      composeBackbone(element);
38798      if (element.hasChromosome()) {
38799        composeCodeableConcept("chromosome", element.getChromosome());
38800      }
38801      if (element.hasGenomeBuildElement()) {
38802        composeStringCore("genomeBuild", element.getGenomeBuildElement(), false);
38803        composeStringExtras("genomeBuild", element.getGenomeBuildElement(), false);
38804      }
38805      if (element.hasReferenceSeqId()) {
38806        composeCodeableConcept("referenceSeqId", element.getReferenceSeqId());
38807      }
38808      if (element.hasReferenceSeqPointer()) {
38809        composeReference("referenceSeqPointer", element.getReferenceSeqPointer());
38810      }
38811      if (element.hasReferenceSeqStringElement()) {
38812        composeStringCore("referenceSeqString", element.getReferenceSeqStringElement(), false);
38813        composeStringExtras("referenceSeqString", element.getReferenceSeqStringElement(), false);
38814      }
38815      if (element.hasStrandElement()) {
38816        composeIntegerCore("strand", element.getStrandElement(), false);
38817        composeIntegerExtras("strand", element.getStrandElement(), false);
38818      }
38819      if (element.hasWindowStartElement()) {
38820        composeIntegerCore("windowStart", element.getWindowStartElement(), false);
38821        composeIntegerExtras("windowStart", element.getWindowStartElement(), false);
38822      }
38823      if (element.hasWindowEndElement()) {
38824        composeIntegerCore("windowEnd", element.getWindowEndElement(), false);
38825        composeIntegerExtras("windowEnd", element.getWindowEndElement(), false);
38826      }
38827  }
38828
38829  protected void composeSequenceSequenceVariantComponent(String name, Sequence.SequenceVariantComponent element) throws IOException {
38830    if (element != null) {
38831      open(name);
38832      composeSequenceSequenceVariantComponentInner(element);
38833      close();
38834    }
38835  }
38836
38837  protected void composeSequenceSequenceVariantComponentInner(Sequence.SequenceVariantComponent element) throws IOException {
38838      composeBackbone(element);
38839      if (element.hasStartElement()) {
38840        composeIntegerCore("start", element.getStartElement(), false);
38841        composeIntegerExtras("start", element.getStartElement(), false);
38842      }
38843      if (element.hasEndElement()) {
38844        composeIntegerCore("end", element.getEndElement(), false);
38845        composeIntegerExtras("end", element.getEndElement(), false);
38846      }
38847      if (element.hasObservedAlleleElement()) {
38848        composeStringCore("observedAllele", element.getObservedAlleleElement(), false);
38849        composeStringExtras("observedAllele", element.getObservedAlleleElement(), false);
38850      }
38851      if (element.hasReferenceAlleleElement()) {
38852        composeStringCore("referenceAllele", element.getReferenceAlleleElement(), false);
38853        composeStringExtras("referenceAllele", element.getReferenceAlleleElement(), false);
38854      }
38855      if (element.hasCigarElement()) {
38856        composeStringCore("cigar", element.getCigarElement(), false);
38857        composeStringExtras("cigar", element.getCigarElement(), false);
38858      }
38859      if (element.hasVariantPointer()) {
38860        composeReference("variantPointer", element.getVariantPointer());
38861      }
38862  }
38863
38864  protected void composeSequenceSequenceQualityComponent(String name, Sequence.SequenceQualityComponent element) throws IOException {
38865    if (element != null) {
38866      open(name);
38867      composeSequenceSequenceQualityComponentInner(element);
38868      close();
38869    }
38870  }
38871
38872  protected void composeSequenceSequenceQualityComponentInner(Sequence.SequenceQualityComponent element) throws IOException {
38873      composeBackbone(element);
38874      if (element.hasTypeElement()) {
38875        composeEnumerationCore("type", element.getTypeElement(), new Sequence.QualityTypeEnumFactory(), false);
38876        composeEnumerationExtras("type", element.getTypeElement(), new Sequence.QualityTypeEnumFactory(), false);
38877      }
38878      if (element.hasStandardSequence()) {
38879        composeCodeableConcept("standardSequence", element.getStandardSequence());
38880      }
38881      if (element.hasStartElement()) {
38882        composeIntegerCore("start", element.getStartElement(), false);
38883        composeIntegerExtras("start", element.getStartElement(), false);
38884      }
38885      if (element.hasEndElement()) {
38886        composeIntegerCore("end", element.getEndElement(), false);
38887        composeIntegerExtras("end", element.getEndElement(), false);
38888      }
38889      if (element.hasScore()) {
38890        composeQuantity("score", element.getScore());
38891      }
38892      if (element.hasMethod()) {
38893        composeCodeableConcept("method", element.getMethod());
38894      }
38895      if (element.hasTruthTPElement()) {
38896        composeDecimalCore("truthTP", element.getTruthTPElement(), false);
38897        composeDecimalExtras("truthTP", element.getTruthTPElement(), false);
38898      }
38899      if (element.hasQueryTPElement()) {
38900        composeDecimalCore("queryTP", element.getQueryTPElement(), false);
38901        composeDecimalExtras("queryTP", element.getQueryTPElement(), false);
38902      }
38903      if (element.hasTruthFNElement()) {
38904        composeDecimalCore("truthFN", element.getTruthFNElement(), false);
38905        composeDecimalExtras("truthFN", element.getTruthFNElement(), false);
38906      }
38907      if (element.hasQueryFPElement()) {
38908        composeDecimalCore("queryFP", element.getQueryFPElement(), false);
38909        composeDecimalExtras("queryFP", element.getQueryFPElement(), false);
38910      }
38911      if (element.hasGtFPElement()) {
38912        composeDecimalCore("gtFP", element.getGtFPElement(), false);
38913        composeDecimalExtras("gtFP", element.getGtFPElement(), false);
38914      }
38915      if (element.hasPrecisionElement()) {
38916        composeDecimalCore("precision", element.getPrecisionElement(), false);
38917        composeDecimalExtras("precision", element.getPrecisionElement(), false);
38918      }
38919      if (element.hasRecallElement()) {
38920        composeDecimalCore("recall", element.getRecallElement(), false);
38921        composeDecimalExtras("recall", element.getRecallElement(), false);
38922      }
38923      if (element.hasFScoreElement()) {
38924        composeDecimalCore("fScore", element.getFScoreElement(), false);
38925        composeDecimalExtras("fScore", element.getFScoreElement(), false);
38926      }
38927  }
38928
38929  protected void composeSequenceSequenceRepositoryComponent(String name, Sequence.SequenceRepositoryComponent element) throws IOException {
38930    if (element != null) {
38931      open(name);
38932      composeSequenceSequenceRepositoryComponentInner(element);
38933      close();
38934    }
38935  }
38936
38937  protected void composeSequenceSequenceRepositoryComponentInner(Sequence.SequenceRepositoryComponent element) throws IOException {
38938      composeBackbone(element);
38939      if (element.hasTypeElement()) {
38940        composeEnumerationCore("type", element.getTypeElement(), new Sequence.RepositoryTypeEnumFactory(), false);
38941        composeEnumerationExtras("type", element.getTypeElement(), new Sequence.RepositoryTypeEnumFactory(), false);
38942      }
38943      if (element.hasUrlElement()) {
38944        composeUriCore("url", element.getUrlElement(), false);
38945        composeUriExtras("url", element.getUrlElement(), false);
38946      }
38947      if (element.hasNameElement()) {
38948        composeStringCore("name", element.getNameElement(), false);
38949        composeStringExtras("name", element.getNameElement(), false);
38950      }
38951      if (element.hasDatasetIdElement()) {
38952        composeStringCore("datasetId", element.getDatasetIdElement(), false);
38953        composeStringExtras("datasetId", element.getDatasetIdElement(), false);
38954      }
38955      if (element.hasVariantsetIdElement()) {
38956        composeStringCore("variantsetId", element.getVariantsetIdElement(), false);
38957        composeStringExtras("variantsetId", element.getVariantsetIdElement(), false);
38958      }
38959      if (element.hasReadsetIdElement()) {
38960        composeStringCore("readsetId", element.getReadsetIdElement(), false);
38961        composeStringExtras("readsetId", element.getReadsetIdElement(), false);
38962      }
38963  }
38964
38965  protected void composeServiceDefinition(String name, ServiceDefinition element) throws IOException {
38966    if (element != null) {
38967      prop("resourceType", name);
38968      composeServiceDefinitionInner(element);
38969    }
38970  }
38971
38972  protected void composeServiceDefinitionInner(ServiceDefinition element) throws IOException {
38973      composeDomainResourceElements(element);
38974      if (element.hasUrlElement()) {
38975        composeUriCore("url", element.getUrlElement(), false);
38976        composeUriExtras("url", element.getUrlElement(), false);
38977      }
38978      if (element.hasIdentifier()) {
38979        openArray("identifier");
38980        for (Identifier e : element.getIdentifier()) 
38981          composeIdentifier(null, e);
38982        closeArray();
38983      };
38984      if (element.hasVersionElement()) {
38985        composeStringCore("version", element.getVersionElement(), false);
38986        composeStringExtras("version", element.getVersionElement(), false);
38987      }
38988      if (element.hasNameElement()) {
38989        composeStringCore("name", element.getNameElement(), false);
38990        composeStringExtras("name", element.getNameElement(), false);
38991      }
38992      if (element.hasTitleElement()) {
38993        composeStringCore("title", element.getTitleElement(), false);
38994        composeStringExtras("title", element.getTitleElement(), false);
38995      }
38996      if (element.hasStatusElement()) {
38997        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
38998        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
38999      }
39000      if (element.hasExperimentalElement()) {
39001        composeBooleanCore("experimental", element.getExperimentalElement(), false);
39002        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
39003      }
39004      if (element.hasDateElement()) {
39005        composeDateTimeCore("date", element.getDateElement(), false);
39006        composeDateTimeExtras("date", element.getDateElement(), false);
39007      }
39008      if (element.hasPublisherElement()) {
39009        composeStringCore("publisher", element.getPublisherElement(), false);
39010        composeStringExtras("publisher", element.getPublisherElement(), false);
39011      }
39012      if (element.hasDescriptionElement()) {
39013        composeMarkdownCore("description", element.getDescriptionElement(), false);
39014        composeMarkdownExtras("description", element.getDescriptionElement(), false);
39015      }
39016      if (element.hasPurposeElement()) {
39017        composeMarkdownCore("purpose", element.getPurposeElement(), false);
39018        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
39019      }
39020      if (element.hasUsageElement()) {
39021        composeStringCore("usage", element.getUsageElement(), false);
39022        composeStringExtras("usage", element.getUsageElement(), false);
39023      }
39024      if (element.hasApprovalDateElement()) {
39025        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
39026        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
39027      }
39028      if (element.hasLastReviewDateElement()) {
39029        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
39030        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
39031      }
39032      if (element.hasEffectivePeriod()) {
39033        composePeriod("effectivePeriod", element.getEffectivePeriod());
39034      }
39035      if (element.hasUseContext()) {
39036        openArray("useContext");
39037        for (UsageContext e : element.getUseContext()) 
39038          composeUsageContext(null, e);
39039        closeArray();
39040      };
39041      if (element.hasJurisdiction()) {
39042        openArray("jurisdiction");
39043        for (CodeableConcept e : element.getJurisdiction()) 
39044          composeCodeableConcept(null, e);
39045        closeArray();
39046      };
39047      if (element.hasTopic()) {
39048        openArray("topic");
39049        for (CodeableConcept e : element.getTopic()) 
39050          composeCodeableConcept(null, e);
39051        closeArray();
39052      };
39053      if (element.hasContributor()) {
39054        openArray("contributor");
39055        for (Contributor e : element.getContributor()) 
39056          composeContributor(null, e);
39057        closeArray();
39058      };
39059      if (element.hasContact()) {
39060        openArray("contact");
39061        for (ContactDetail e : element.getContact()) 
39062          composeContactDetail(null, e);
39063        closeArray();
39064      };
39065      if (element.hasCopyrightElement()) {
39066        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
39067        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
39068      }
39069      if (element.hasRelatedArtifact()) {
39070        openArray("relatedArtifact");
39071        for (RelatedArtifact e : element.getRelatedArtifact()) 
39072          composeRelatedArtifact(null, e);
39073        closeArray();
39074      };
39075      if (element.hasTrigger()) {
39076        openArray("trigger");
39077        for (TriggerDefinition e : element.getTrigger()) 
39078          composeTriggerDefinition(null, e);
39079        closeArray();
39080      };
39081      if (element.hasDataRequirement()) {
39082        openArray("dataRequirement");
39083        for (DataRequirement e : element.getDataRequirement()) 
39084          composeDataRequirement(null, e);
39085        closeArray();
39086      };
39087      if (element.hasOperationDefinition()) {
39088        composeReference("operationDefinition", element.getOperationDefinition());
39089      }
39090  }
39091
39092  protected void composeSlot(String name, Slot element) throws IOException {
39093    if (element != null) {
39094      prop("resourceType", name);
39095      composeSlotInner(element);
39096    }
39097  }
39098
39099  protected void composeSlotInner(Slot element) throws IOException {
39100      composeDomainResourceElements(element);
39101      if (element.hasIdentifier()) {
39102        openArray("identifier");
39103        for (Identifier e : element.getIdentifier()) 
39104          composeIdentifier(null, e);
39105        closeArray();
39106      };
39107      if (element.hasServiceCategory()) {
39108        composeCodeableConcept("serviceCategory", element.getServiceCategory());
39109      }
39110      if (element.hasServiceType()) {
39111        openArray("serviceType");
39112        for (CodeableConcept e : element.getServiceType()) 
39113          composeCodeableConcept(null, e);
39114        closeArray();
39115      };
39116      if (element.hasSpecialty()) {
39117        openArray("specialty");
39118        for (CodeableConcept e : element.getSpecialty()) 
39119          composeCodeableConcept(null, e);
39120        closeArray();
39121      };
39122      if (element.hasAppointmentType()) {
39123        composeCodeableConcept("appointmentType", element.getAppointmentType());
39124      }
39125      if (element.hasSchedule()) {
39126        composeReference("schedule", element.getSchedule());
39127      }
39128      if (element.hasStatusElement()) {
39129        composeEnumerationCore("status", element.getStatusElement(), new Slot.SlotStatusEnumFactory(), false);
39130        composeEnumerationExtras("status", element.getStatusElement(), new Slot.SlotStatusEnumFactory(), false);
39131      }
39132      if (element.hasStartElement()) {
39133        composeInstantCore("start", element.getStartElement(), false);
39134        composeInstantExtras("start", element.getStartElement(), false);
39135      }
39136      if (element.hasEndElement()) {
39137        composeInstantCore("end", element.getEndElement(), false);
39138        composeInstantExtras("end", element.getEndElement(), false);
39139      }
39140      if (element.hasOverbookedElement()) {
39141        composeBooleanCore("overbooked", element.getOverbookedElement(), false);
39142        composeBooleanExtras("overbooked", element.getOverbookedElement(), false);
39143      }
39144      if (element.hasCommentElement()) {
39145        composeStringCore("comment", element.getCommentElement(), false);
39146        composeStringExtras("comment", element.getCommentElement(), false);
39147      }
39148  }
39149
39150  protected void composeSpecimen(String name, Specimen element) throws IOException {
39151    if (element != null) {
39152      prop("resourceType", name);
39153      composeSpecimenInner(element);
39154    }
39155  }
39156
39157  protected void composeSpecimenInner(Specimen element) throws IOException {
39158      composeDomainResourceElements(element);
39159      if (element.hasIdentifier()) {
39160        openArray("identifier");
39161        for (Identifier e : element.getIdentifier()) 
39162          composeIdentifier(null, e);
39163        closeArray();
39164      };
39165      if (element.hasAccessionIdentifier()) {
39166        composeIdentifier("accessionIdentifier", element.getAccessionIdentifier());
39167      }
39168      if (element.hasStatusElement()) {
39169        composeEnumerationCore("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory(), false);
39170        composeEnumerationExtras("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory(), false);
39171      }
39172      if (element.hasType()) {
39173        composeCodeableConcept("type", element.getType());
39174      }
39175      if (element.hasSubject()) {
39176        composeReference("subject", element.getSubject());
39177      }
39178      if (element.hasReceivedTimeElement()) {
39179        composeDateTimeCore("receivedTime", element.getReceivedTimeElement(), false);
39180        composeDateTimeExtras("receivedTime", element.getReceivedTimeElement(), false);
39181      }
39182      if (element.hasParent()) {
39183        openArray("parent");
39184        for (Reference e : element.getParent()) 
39185          composeReference(null, e);
39186        closeArray();
39187      };
39188      if (element.hasRequest()) {
39189        openArray("request");
39190        for (Reference e : element.getRequest()) 
39191          composeReference(null, e);
39192        closeArray();
39193      };
39194      if (element.hasCollection()) {
39195        composeSpecimenSpecimenCollectionComponent("collection", element.getCollection());
39196      }
39197      if (element.hasProcessing()) {
39198        openArray("processing");
39199        for (Specimen.SpecimenProcessingComponent e : element.getProcessing()) 
39200          composeSpecimenSpecimenProcessingComponent(null, e);
39201        closeArray();
39202      };
39203      if (element.hasContainer()) {
39204        openArray("container");
39205        for (Specimen.SpecimenContainerComponent e : element.getContainer()) 
39206          composeSpecimenSpecimenContainerComponent(null, e);
39207        closeArray();
39208      };
39209      if (element.hasNote()) {
39210        openArray("note");
39211        for (Annotation e : element.getNote()) 
39212          composeAnnotation(null, e);
39213        closeArray();
39214      };
39215  }
39216
39217  protected void composeSpecimenSpecimenCollectionComponent(String name, Specimen.SpecimenCollectionComponent element) throws IOException {
39218    if (element != null) {
39219      open(name);
39220      composeSpecimenSpecimenCollectionComponentInner(element);
39221      close();
39222    }
39223  }
39224
39225  protected void composeSpecimenSpecimenCollectionComponentInner(Specimen.SpecimenCollectionComponent element) throws IOException {
39226      composeBackbone(element);
39227      if (element.hasCollector()) {
39228        composeReference("collector", element.getCollector());
39229      }
39230      if (element.hasCollected()) {
39231        composeType("collected", element.getCollected());
39232      }
39233      if (element.hasQuantity()) {
39234        composeSimpleQuantity("quantity", element.getQuantity());
39235      }
39236      if (element.hasMethod()) {
39237        composeCodeableConcept("method", element.getMethod());
39238      }
39239      if (element.hasBodySite()) {
39240        composeCodeableConcept("bodySite", element.getBodySite());
39241      }
39242  }
39243
39244  protected void composeSpecimenSpecimenProcessingComponent(String name, Specimen.SpecimenProcessingComponent element) throws IOException {
39245    if (element != null) {
39246      open(name);
39247      composeSpecimenSpecimenProcessingComponentInner(element);
39248      close();
39249    }
39250  }
39251
39252  protected void composeSpecimenSpecimenProcessingComponentInner(Specimen.SpecimenProcessingComponent element) throws IOException {
39253      composeBackbone(element);
39254      if (element.hasDescriptionElement()) {
39255        composeStringCore("description", element.getDescriptionElement(), false);
39256        composeStringExtras("description", element.getDescriptionElement(), false);
39257      }
39258      if (element.hasProcedure()) {
39259        composeCodeableConcept("procedure", element.getProcedure());
39260      }
39261      if (element.hasAdditive()) {
39262        openArray("additive");
39263        for (Reference e : element.getAdditive()) 
39264          composeReference(null, e);
39265        closeArray();
39266      };
39267      if (element.hasTime()) {
39268        composeType("time", element.getTime());
39269      }
39270  }
39271
39272  protected void composeSpecimenSpecimenContainerComponent(String name, Specimen.SpecimenContainerComponent element) throws IOException {
39273    if (element != null) {
39274      open(name);
39275      composeSpecimenSpecimenContainerComponentInner(element);
39276      close();
39277    }
39278  }
39279
39280  protected void composeSpecimenSpecimenContainerComponentInner(Specimen.SpecimenContainerComponent element) throws IOException {
39281      composeBackbone(element);
39282      if (element.hasIdentifier()) {
39283        openArray("identifier");
39284        for (Identifier e : element.getIdentifier()) 
39285          composeIdentifier(null, e);
39286        closeArray();
39287      };
39288      if (element.hasDescriptionElement()) {
39289        composeStringCore("description", element.getDescriptionElement(), false);
39290        composeStringExtras("description", element.getDescriptionElement(), false);
39291      }
39292      if (element.hasType()) {
39293        composeCodeableConcept("type", element.getType());
39294      }
39295      if (element.hasCapacity()) {
39296        composeSimpleQuantity("capacity", element.getCapacity());
39297      }
39298      if (element.hasSpecimenQuantity()) {
39299        composeSimpleQuantity("specimenQuantity", element.getSpecimenQuantity());
39300      }
39301      if (element.hasAdditive()) {
39302        composeType("additive", element.getAdditive());
39303      }
39304  }
39305
39306  protected void composeStructureDefinition(String name, StructureDefinition element) throws IOException {
39307    if (element != null) {
39308      prop("resourceType", name);
39309      composeStructureDefinitionInner(element);
39310    }
39311  }
39312
39313  protected void composeStructureDefinitionInner(StructureDefinition element) throws IOException {
39314      composeDomainResourceElements(element);
39315      if (element.hasUrlElement()) {
39316        composeUriCore("url", element.getUrlElement(), false);
39317        composeUriExtras("url", element.getUrlElement(), false);
39318      }
39319      if (element.hasIdentifier()) {
39320        openArray("identifier");
39321        for (Identifier e : element.getIdentifier()) 
39322          composeIdentifier(null, e);
39323        closeArray();
39324      };
39325      if (element.hasVersionElement()) {
39326        composeStringCore("version", element.getVersionElement(), false);
39327        composeStringExtras("version", element.getVersionElement(), false);
39328      }
39329      if (element.hasNameElement()) {
39330        composeStringCore("name", element.getNameElement(), false);
39331        composeStringExtras("name", element.getNameElement(), false);
39332      }
39333      if (element.hasTitleElement()) {
39334        composeStringCore("title", element.getTitleElement(), false);
39335        composeStringExtras("title", element.getTitleElement(), false);
39336      }
39337      if (element.hasStatusElement()) {
39338        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
39339        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
39340      }
39341      if (element.hasExperimentalElement()) {
39342        composeBooleanCore("experimental", element.getExperimentalElement(), false);
39343        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
39344      }
39345      if (element.hasDateElement()) {
39346        composeDateTimeCore("date", element.getDateElement(), false);
39347        composeDateTimeExtras("date", element.getDateElement(), false);
39348      }
39349      if (element.hasPublisherElement()) {
39350        composeStringCore("publisher", element.getPublisherElement(), false);
39351        composeStringExtras("publisher", element.getPublisherElement(), false);
39352      }
39353      if (element.hasContact()) {
39354        openArray("contact");
39355        for (ContactDetail e : element.getContact()) 
39356          composeContactDetail(null, e);
39357        closeArray();
39358      };
39359      if (element.hasDescriptionElement()) {
39360        composeMarkdownCore("description", element.getDescriptionElement(), false);
39361        composeMarkdownExtras("description", element.getDescriptionElement(), false);
39362      }
39363      if (element.hasUseContext()) {
39364        openArray("useContext");
39365        for (UsageContext e : element.getUseContext()) 
39366          composeUsageContext(null, e);
39367        closeArray();
39368      };
39369      if (element.hasJurisdiction()) {
39370        openArray("jurisdiction");
39371        for (CodeableConcept e : element.getJurisdiction()) 
39372          composeCodeableConcept(null, e);
39373        closeArray();
39374      };
39375      if (element.hasPurposeElement()) {
39376        composeMarkdownCore("purpose", element.getPurposeElement(), false);
39377        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
39378      }
39379      if (element.hasCopyrightElement()) {
39380        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
39381        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
39382      }
39383      if (element.hasKeyword()) {
39384        openArray("keyword");
39385        for (Coding e : element.getKeyword()) 
39386          composeCoding(null, e);
39387        closeArray();
39388      };
39389      if (element.hasFhirVersionElement()) {
39390        composeIdCore("fhirVersion", element.getFhirVersionElement(), false);
39391        composeIdExtras("fhirVersion", element.getFhirVersionElement(), false);
39392      }
39393      if (element.hasMapping()) {
39394        openArray("mapping");
39395        for (StructureDefinition.StructureDefinitionMappingComponent e : element.getMapping()) 
39396          composeStructureDefinitionStructureDefinitionMappingComponent(null, e);
39397        closeArray();
39398      };
39399      if (element.hasKindElement()) {
39400        composeEnumerationCore("kind", element.getKindElement(), new StructureDefinition.StructureDefinitionKindEnumFactory(), false);
39401        composeEnumerationExtras("kind", element.getKindElement(), new StructureDefinition.StructureDefinitionKindEnumFactory(), false);
39402      }
39403      if (element.hasAbstractElement()) {
39404        composeBooleanCore("abstract", element.getAbstractElement(), false);
39405        composeBooleanExtras("abstract", element.getAbstractElement(), false);
39406      }
39407      if (element.hasContextTypeElement()) {
39408        composeEnumerationCore("contextType", element.getContextTypeElement(), new StructureDefinition.ExtensionContextEnumFactory(), false);
39409        composeEnumerationExtras("contextType", element.getContextTypeElement(), new StructureDefinition.ExtensionContextEnumFactory(), false);
39410      }
39411      if (element.hasContext()) {
39412        openArray("context");
39413        for (StringType e : element.getContext()) 
39414          composeStringCore(null, e, true);
39415        closeArray();
39416        if (anyHasExtras(element.getContext())) {
39417          openArray("_context");
39418          for (StringType e : element.getContext()) 
39419            composeStringExtras(null, e, true);
39420          closeArray();
39421        }
39422      };
39423      if (element.hasContextInvariant()) {
39424        openArray("contextInvariant");
39425        for (StringType e : element.getContextInvariant()) 
39426          composeStringCore(null, e, true);
39427        closeArray();
39428        if (anyHasExtras(element.getContextInvariant())) {
39429          openArray("_contextInvariant");
39430          for (StringType e : element.getContextInvariant()) 
39431            composeStringExtras(null, e, true);
39432          closeArray();
39433        }
39434      };
39435      if (element.hasTypeElement()) {
39436        composeCodeCore("type", element.getTypeElement(), false);
39437        composeCodeExtras("type", element.getTypeElement(), false);
39438      }
39439      if (element.hasBaseDefinitionElement()) {
39440        composeUriCore("baseDefinition", element.getBaseDefinitionElement(), false);
39441        composeUriExtras("baseDefinition", element.getBaseDefinitionElement(), false);
39442      }
39443      if (element.hasDerivationElement()) {
39444        composeEnumerationCore("derivation", element.getDerivationElement(), new StructureDefinition.TypeDerivationRuleEnumFactory(), false);
39445        composeEnumerationExtras("derivation", element.getDerivationElement(), new StructureDefinition.TypeDerivationRuleEnumFactory(), false);
39446      }
39447      if (element.hasSnapshot()) {
39448        composeStructureDefinitionStructureDefinitionSnapshotComponent("snapshot", element.getSnapshot());
39449      }
39450      if (element.hasDifferential()) {
39451        composeStructureDefinitionStructureDefinitionDifferentialComponent("differential", element.getDifferential());
39452      }
39453  }
39454
39455  protected void composeStructureDefinitionStructureDefinitionMappingComponent(String name, StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
39456    if (element != null) {
39457      open(name);
39458      composeStructureDefinitionStructureDefinitionMappingComponentInner(element);
39459      close();
39460    }
39461  }
39462
39463  protected void composeStructureDefinitionStructureDefinitionMappingComponentInner(StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
39464      composeBackbone(element);
39465      if (element.hasIdentityElement()) {
39466        composeIdCore("identity", element.getIdentityElement(), false);
39467        composeIdExtras("identity", element.getIdentityElement(), false);
39468      }
39469      if (element.hasUriElement()) {
39470        composeUriCore("uri", element.getUriElement(), false);
39471        composeUriExtras("uri", element.getUriElement(), false);
39472      }
39473      if (element.hasNameElement()) {
39474        composeStringCore("name", element.getNameElement(), false);
39475        composeStringExtras("name", element.getNameElement(), false);
39476      }
39477      if (element.hasCommentElement()) {
39478        composeStringCore("comment", element.getCommentElement(), false);
39479        composeStringExtras("comment", element.getCommentElement(), false);
39480      }
39481  }
39482
39483  protected void composeStructureDefinitionStructureDefinitionSnapshotComponent(String name, StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
39484    if (element != null) {
39485      open(name);
39486      composeStructureDefinitionStructureDefinitionSnapshotComponentInner(element);
39487      close();
39488    }
39489  }
39490
39491  protected void composeStructureDefinitionStructureDefinitionSnapshotComponentInner(StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
39492      composeBackbone(element);
39493      if (element.hasElement()) {
39494        openArray("element");
39495        for (ElementDefinition e : element.getElement()) 
39496          composeElementDefinition(null, e);
39497        closeArray();
39498      };
39499  }
39500
39501  protected void composeStructureDefinitionStructureDefinitionDifferentialComponent(String name, StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
39502    if (element != null) {
39503      open(name);
39504      composeStructureDefinitionStructureDefinitionDifferentialComponentInner(element);
39505      close();
39506    }
39507  }
39508
39509  protected void composeStructureDefinitionStructureDefinitionDifferentialComponentInner(StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
39510      composeBackbone(element);
39511      if (element.hasElement()) {
39512        openArray("element");
39513        for (ElementDefinition e : element.getElement()) 
39514          composeElementDefinition(null, e);
39515        closeArray();
39516      };
39517  }
39518
39519  protected void composeStructureMap(String name, StructureMap element) throws IOException {
39520    if (element != null) {
39521      prop("resourceType", name);
39522      composeStructureMapInner(element);
39523    }
39524  }
39525
39526  protected void composeStructureMapInner(StructureMap element) throws IOException {
39527      composeDomainResourceElements(element);
39528      if (element.hasUrlElement()) {
39529        composeUriCore("url", element.getUrlElement(), false);
39530        composeUriExtras("url", element.getUrlElement(), false);
39531      }
39532      if (element.hasIdentifier()) {
39533        openArray("identifier");
39534        for (Identifier e : element.getIdentifier()) 
39535          composeIdentifier(null, e);
39536        closeArray();
39537      };
39538      if (element.hasVersionElement()) {
39539        composeStringCore("version", element.getVersionElement(), false);
39540        composeStringExtras("version", element.getVersionElement(), false);
39541      }
39542      if (element.hasNameElement()) {
39543        composeStringCore("name", element.getNameElement(), false);
39544        composeStringExtras("name", element.getNameElement(), false);
39545      }
39546      if (element.hasTitleElement()) {
39547        composeStringCore("title", element.getTitleElement(), false);
39548        composeStringExtras("title", element.getTitleElement(), false);
39549      }
39550      if (element.hasStatusElement()) {
39551        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
39552        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
39553      }
39554      if (element.hasExperimentalElement()) {
39555        composeBooleanCore("experimental", element.getExperimentalElement(), false);
39556        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
39557      }
39558      if (element.hasDateElement()) {
39559        composeDateTimeCore("date", element.getDateElement(), false);
39560        composeDateTimeExtras("date", element.getDateElement(), false);
39561      }
39562      if (element.hasPublisherElement()) {
39563        composeStringCore("publisher", element.getPublisherElement(), false);
39564        composeStringExtras("publisher", element.getPublisherElement(), false);
39565      }
39566      if (element.hasContact()) {
39567        openArray("contact");
39568        for (ContactDetail e : element.getContact()) 
39569          composeContactDetail(null, e);
39570        closeArray();
39571      };
39572      if (element.hasDescriptionElement()) {
39573        composeMarkdownCore("description", element.getDescriptionElement(), false);
39574        composeMarkdownExtras("description", element.getDescriptionElement(), false);
39575      }
39576      if (element.hasUseContext()) {
39577        openArray("useContext");
39578        for (UsageContext e : element.getUseContext()) 
39579          composeUsageContext(null, e);
39580        closeArray();
39581      };
39582      if (element.hasJurisdiction()) {
39583        openArray("jurisdiction");
39584        for (CodeableConcept e : element.getJurisdiction()) 
39585          composeCodeableConcept(null, e);
39586        closeArray();
39587      };
39588      if (element.hasPurposeElement()) {
39589        composeMarkdownCore("purpose", element.getPurposeElement(), false);
39590        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
39591      }
39592      if (element.hasCopyrightElement()) {
39593        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
39594        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
39595      }
39596      if (element.hasStructure()) {
39597        openArray("structure");
39598        for (StructureMap.StructureMapStructureComponent e : element.getStructure()) 
39599          composeStructureMapStructureMapStructureComponent(null, e);
39600        closeArray();
39601      };
39602      if (element.hasImport()) {
39603        openArray("import");
39604        for (UriType e : element.getImport()) 
39605          composeUriCore(null, e, true);
39606        closeArray();
39607        if (anyHasExtras(element.getImport())) {
39608          openArray("_import");
39609          for (UriType e : element.getImport()) 
39610            composeUriExtras(null, e, true);
39611          closeArray();
39612        }
39613      };
39614      if (element.hasGroup()) {
39615        openArray("group");
39616        for (StructureMap.StructureMapGroupComponent e : element.getGroup()) 
39617          composeStructureMapStructureMapGroupComponent(null, e);
39618        closeArray();
39619      };
39620  }
39621
39622  protected void composeStructureMapStructureMapStructureComponent(String name, StructureMap.StructureMapStructureComponent element) throws IOException {
39623    if (element != null) {
39624      open(name);
39625      composeStructureMapStructureMapStructureComponentInner(element);
39626      close();
39627    }
39628  }
39629
39630  protected void composeStructureMapStructureMapStructureComponentInner(StructureMap.StructureMapStructureComponent element) throws IOException {
39631      composeBackbone(element);
39632      if (element.hasUrlElement()) {
39633        composeUriCore("url", element.getUrlElement(), false);
39634        composeUriExtras("url", element.getUrlElement(), false);
39635      }
39636      if (element.hasModeElement()) {
39637        composeEnumerationCore("mode", element.getModeElement(), new StructureMap.StructureMapModelModeEnumFactory(), false);
39638        composeEnumerationExtras("mode", element.getModeElement(), new StructureMap.StructureMapModelModeEnumFactory(), false);
39639      }
39640      if (element.hasAliasElement()) {
39641        composeStringCore("alias", element.getAliasElement(), false);
39642        composeStringExtras("alias", element.getAliasElement(), false);
39643      }
39644      if (element.hasDocumentationElement()) {
39645        composeStringCore("documentation", element.getDocumentationElement(), false);
39646        composeStringExtras("documentation", element.getDocumentationElement(), false);
39647      }
39648  }
39649
39650  protected void composeStructureMapStructureMapGroupComponent(String name, StructureMap.StructureMapGroupComponent element) throws IOException {
39651    if (element != null) {
39652      open(name);
39653      composeStructureMapStructureMapGroupComponentInner(element);
39654      close();
39655    }
39656  }
39657
39658  protected void composeStructureMapStructureMapGroupComponentInner(StructureMap.StructureMapGroupComponent element) throws IOException {
39659      composeBackbone(element);
39660      if (element.hasNameElement()) {
39661        composeIdCore("name", element.getNameElement(), false);
39662        composeIdExtras("name", element.getNameElement(), false);
39663      }
39664      if (element.hasExtendsElement()) {
39665        composeIdCore("extends", element.getExtendsElement(), false);
39666        composeIdExtras("extends", element.getExtendsElement(), false);
39667      }
39668      if (element.hasTypeModeElement()) {
39669        composeEnumerationCore("typeMode", element.getTypeModeElement(), new StructureMap.StructureMapGroupTypeModeEnumFactory(), false);
39670        composeEnumerationExtras("typeMode", element.getTypeModeElement(), new StructureMap.StructureMapGroupTypeModeEnumFactory(), false);
39671      }
39672      if (element.hasDocumentationElement()) {
39673        composeStringCore("documentation", element.getDocumentationElement(), false);
39674        composeStringExtras("documentation", element.getDocumentationElement(), false);
39675      }
39676      if (element.hasInput()) {
39677        openArray("input");
39678        for (StructureMap.StructureMapGroupInputComponent e : element.getInput()) 
39679          composeStructureMapStructureMapGroupInputComponent(null, e);
39680        closeArray();
39681      };
39682      if (element.hasRule()) {
39683        openArray("rule");
39684        for (StructureMap.StructureMapGroupRuleComponent e : element.getRule()) 
39685          composeStructureMapStructureMapGroupRuleComponent(null, e);
39686        closeArray();
39687      };
39688  }
39689
39690  protected void composeStructureMapStructureMapGroupInputComponent(String name, StructureMap.StructureMapGroupInputComponent element) throws IOException {
39691    if (element != null) {
39692      open(name);
39693      composeStructureMapStructureMapGroupInputComponentInner(element);
39694      close();
39695    }
39696  }
39697
39698  protected void composeStructureMapStructureMapGroupInputComponentInner(StructureMap.StructureMapGroupInputComponent element) throws IOException {
39699      composeBackbone(element);
39700      if (element.hasNameElement()) {
39701        composeIdCore("name", element.getNameElement(), false);
39702        composeIdExtras("name", element.getNameElement(), false);
39703      }
39704      if (element.hasTypeElement()) {
39705        composeStringCore("type", element.getTypeElement(), false);
39706        composeStringExtras("type", element.getTypeElement(), false);
39707      }
39708      if (element.hasModeElement()) {
39709        composeEnumerationCore("mode", element.getModeElement(), new StructureMap.StructureMapInputModeEnumFactory(), false);
39710        composeEnumerationExtras("mode", element.getModeElement(), new StructureMap.StructureMapInputModeEnumFactory(), false);
39711      }
39712      if (element.hasDocumentationElement()) {
39713        composeStringCore("documentation", element.getDocumentationElement(), false);
39714        composeStringExtras("documentation", element.getDocumentationElement(), false);
39715      }
39716  }
39717
39718  protected void composeStructureMapStructureMapGroupRuleComponent(String name, StructureMap.StructureMapGroupRuleComponent element) throws IOException {
39719    if (element != null) {
39720      open(name);
39721      composeStructureMapStructureMapGroupRuleComponentInner(element);
39722      close();
39723    }
39724  }
39725
39726  protected void composeStructureMapStructureMapGroupRuleComponentInner(StructureMap.StructureMapGroupRuleComponent element) throws IOException {
39727      composeBackbone(element);
39728      if (element.hasNameElement()) {
39729        composeIdCore("name", element.getNameElement(), false);
39730        composeIdExtras("name", element.getNameElement(), false);
39731      }
39732      if (element.hasSource()) {
39733        openArray("source");
39734        for (StructureMap.StructureMapGroupRuleSourceComponent e : element.getSource()) 
39735          composeStructureMapStructureMapGroupRuleSourceComponent(null, e);
39736        closeArray();
39737      };
39738      if (element.hasTarget()) {
39739        openArray("target");
39740        for (StructureMap.StructureMapGroupRuleTargetComponent e : element.getTarget()) 
39741          composeStructureMapStructureMapGroupRuleTargetComponent(null, e);
39742        closeArray();
39743      };
39744      if (element.hasRule()) {
39745        openArray("rule");
39746        for (StructureMap.StructureMapGroupRuleComponent e : element.getRule()) 
39747          composeStructureMapStructureMapGroupRuleComponent(null, e);
39748        closeArray();
39749      };
39750      if (element.hasDependent()) {
39751        openArray("dependent");
39752        for (StructureMap.StructureMapGroupRuleDependentComponent e : element.getDependent()) 
39753          composeStructureMapStructureMapGroupRuleDependentComponent(null, e);
39754        closeArray();
39755      };
39756      if (element.hasDocumentationElement()) {
39757        composeStringCore("documentation", element.getDocumentationElement(), false);
39758        composeStringExtras("documentation", element.getDocumentationElement(), false);
39759      }
39760  }
39761
39762  protected void composeStructureMapStructureMapGroupRuleSourceComponent(String name, StructureMap.StructureMapGroupRuleSourceComponent element) throws IOException {
39763    if (element != null) {
39764      open(name);
39765      composeStructureMapStructureMapGroupRuleSourceComponentInner(element);
39766      close();
39767    }
39768  }
39769
39770  protected void composeStructureMapStructureMapGroupRuleSourceComponentInner(StructureMap.StructureMapGroupRuleSourceComponent element) throws IOException {
39771      composeBackbone(element);
39772      if (element.hasContextElement()) {
39773        composeIdCore("context", element.getContextElement(), false);
39774        composeIdExtras("context", element.getContextElement(), false);
39775      }
39776      if (element.hasMinElement()) {
39777        composeIntegerCore("min", element.getMinElement(), false);
39778        composeIntegerExtras("min", element.getMinElement(), false);
39779      }
39780      if (element.hasMaxElement()) {
39781        composeStringCore("max", element.getMaxElement(), false);
39782        composeStringExtras("max", element.getMaxElement(), false);
39783      }
39784      if (element.hasTypeElement()) {
39785        composeStringCore("type", element.getTypeElement(), false);
39786        composeStringExtras("type", element.getTypeElement(), false);
39787      }
39788      if (element.hasDefaultValue()) {
39789        composeType("defaultValue", element.getDefaultValue());
39790      }
39791      if (element.hasElementElement()) {
39792        composeStringCore("element", element.getElementElement(), false);
39793        composeStringExtras("element", element.getElementElement(), false);
39794      }
39795      if (element.hasListModeElement()) {
39796        composeEnumerationCore("listMode", element.getListModeElement(), new StructureMap.StructureMapSourceListModeEnumFactory(), false);
39797        composeEnumerationExtras("listMode", element.getListModeElement(), new StructureMap.StructureMapSourceListModeEnumFactory(), false);
39798      }
39799      if (element.hasVariableElement()) {
39800        composeIdCore("variable", element.getVariableElement(), false);
39801        composeIdExtras("variable", element.getVariableElement(), false);
39802      }
39803      if (element.hasConditionElement()) {
39804        composeStringCore("condition", element.getConditionElement(), false);
39805        composeStringExtras("condition", element.getConditionElement(), false);
39806      }
39807      if (element.hasCheckElement()) {
39808        composeStringCore("check", element.getCheckElement(), false);
39809        composeStringExtras("check", element.getCheckElement(), false);
39810      }
39811  }
39812
39813  protected void composeStructureMapStructureMapGroupRuleTargetComponent(String name, StructureMap.StructureMapGroupRuleTargetComponent element) throws IOException {
39814    if (element != null) {
39815      open(name);
39816      composeStructureMapStructureMapGroupRuleTargetComponentInner(element);
39817      close();
39818    }
39819  }
39820
39821  protected void composeStructureMapStructureMapGroupRuleTargetComponentInner(StructureMap.StructureMapGroupRuleTargetComponent element) throws IOException {
39822      composeBackbone(element);
39823      if (element.hasContextElement()) {
39824        composeIdCore("context", element.getContextElement(), false);
39825        composeIdExtras("context", element.getContextElement(), false);
39826      }
39827      if (element.hasContextTypeElement()) {
39828        composeEnumerationCore("contextType", element.getContextTypeElement(), new StructureMap.StructureMapContextTypeEnumFactory(), false);
39829        composeEnumerationExtras("contextType", element.getContextTypeElement(), new StructureMap.StructureMapContextTypeEnumFactory(), false);
39830      }
39831      if (element.hasElementElement()) {
39832        composeStringCore("element", element.getElementElement(), false);
39833        composeStringExtras("element", element.getElementElement(), false);
39834      }
39835      if (element.hasVariableElement()) {
39836        composeIdCore("variable", element.getVariableElement(), false);
39837        composeIdExtras("variable", element.getVariableElement(), false);
39838      }
39839      if (element.hasListMode()) {
39840        openArray("listMode");
39841        for (Enumeration<StructureMap.StructureMapTargetListMode> e : element.getListMode()) 
39842          composeEnumerationCore(null, e, new StructureMap.StructureMapTargetListModeEnumFactory(), true);
39843        closeArray();
39844        if (anyHasExtras(element.getListMode())) {
39845          openArray("_listMode");
39846          for (Enumeration<StructureMap.StructureMapTargetListMode> e : element.getListMode()) 
39847            composeEnumerationExtras(null, e, new StructureMap.StructureMapTargetListModeEnumFactory(), true);
39848          closeArray();
39849        }
39850      };
39851      if (element.hasListRuleIdElement()) {
39852        composeIdCore("listRuleId", element.getListRuleIdElement(), false);
39853        composeIdExtras("listRuleId", element.getListRuleIdElement(), false);
39854      }
39855      if (element.hasTransformElement()) {
39856        composeEnumerationCore("transform", element.getTransformElement(), new StructureMap.StructureMapTransformEnumFactory(), false);
39857        composeEnumerationExtras("transform", element.getTransformElement(), new StructureMap.StructureMapTransformEnumFactory(), false);
39858      }
39859      if (element.hasParameter()) {
39860        openArray("parameter");
39861        for (StructureMap.StructureMapGroupRuleTargetParameterComponent e : element.getParameter()) 
39862          composeStructureMapStructureMapGroupRuleTargetParameterComponent(null, e);
39863        closeArray();
39864      };
39865  }
39866
39867  protected void composeStructureMapStructureMapGroupRuleTargetParameterComponent(String name, StructureMap.StructureMapGroupRuleTargetParameterComponent element) throws IOException {
39868    if (element != null) {
39869      open(name);
39870      composeStructureMapStructureMapGroupRuleTargetParameterComponentInner(element);
39871      close();
39872    }
39873  }
39874
39875  protected void composeStructureMapStructureMapGroupRuleTargetParameterComponentInner(StructureMap.StructureMapGroupRuleTargetParameterComponent element) throws IOException {
39876      composeBackbone(element);
39877      if (element.hasValue()) {
39878        composeType("value", element.getValue());
39879      }
39880  }
39881
39882  protected void composeStructureMapStructureMapGroupRuleDependentComponent(String name, StructureMap.StructureMapGroupRuleDependentComponent element) throws IOException {
39883    if (element != null) {
39884      open(name);
39885      composeStructureMapStructureMapGroupRuleDependentComponentInner(element);
39886      close();
39887    }
39888  }
39889
39890  protected void composeStructureMapStructureMapGroupRuleDependentComponentInner(StructureMap.StructureMapGroupRuleDependentComponent element) throws IOException {
39891      composeBackbone(element);
39892      if (element.hasNameElement()) {
39893        composeIdCore("name", element.getNameElement(), false);
39894        composeIdExtras("name", element.getNameElement(), false);
39895      }
39896      if (element.hasVariable()) {
39897        openArray("variable");
39898        for (StringType e : element.getVariable()) 
39899          composeStringCore(null, e, true);
39900        closeArray();
39901        if (anyHasExtras(element.getVariable())) {
39902          openArray("_variable");
39903          for (StringType e : element.getVariable()) 
39904            composeStringExtras(null, e, true);
39905          closeArray();
39906        }
39907      };
39908  }
39909
39910  protected void composeSubscription(String name, Subscription element) throws IOException {
39911    if (element != null) {
39912      prop("resourceType", name);
39913      composeSubscriptionInner(element);
39914    }
39915  }
39916
39917  protected void composeSubscriptionInner(Subscription element) throws IOException {
39918      composeDomainResourceElements(element);
39919      if (element.hasStatusElement()) {
39920        composeEnumerationCore("status", element.getStatusElement(), new Subscription.SubscriptionStatusEnumFactory(), false);
39921        composeEnumerationExtras("status", element.getStatusElement(), new Subscription.SubscriptionStatusEnumFactory(), false);
39922      }
39923      if (element.hasContact()) {
39924        openArray("contact");
39925        for (ContactPoint e : element.getContact()) 
39926          composeContactPoint(null, e);
39927        closeArray();
39928      };
39929      if (element.hasEndElement()) {
39930        composeInstantCore("end", element.getEndElement(), false);
39931        composeInstantExtras("end", element.getEndElement(), false);
39932      }
39933      if (element.hasReasonElement()) {
39934        composeStringCore("reason", element.getReasonElement(), false);
39935        composeStringExtras("reason", element.getReasonElement(), false);
39936      }
39937      if (element.hasCriteriaElement()) {
39938        composeStringCore("criteria", element.getCriteriaElement(), false);
39939        composeStringExtras("criteria", element.getCriteriaElement(), false);
39940      }
39941      if (element.hasErrorElement()) {
39942        composeStringCore("error", element.getErrorElement(), false);
39943        composeStringExtras("error", element.getErrorElement(), false);
39944      }
39945      if (element.hasChannel()) {
39946        composeSubscriptionSubscriptionChannelComponent("channel", element.getChannel());
39947      }
39948      if (element.hasTag()) {
39949        openArray("tag");
39950        for (Coding e : element.getTag()) 
39951          composeCoding(null, e);
39952        closeArray();
39953      };
39954  }
39955
39956  protected void composeSubscriptionSubscriptionChannelComponent(String name, Subscription.SubscriptionChannelComponent element) throws IOException {
39957    if (element != null) {
39958      open(name);
39959      composeSubscriptionSubscriptionChannelComponentInner(element);
39960      close();
39961    }
39962  }
39963
39964  protected void composeSubscriptionSubscriptionChannelComponentInner(Subscription.SubscriptionChannelComponent element) throws IOException {
39965      composeBackbone(element);
39966      if (element.hasTypeElement()) {
39967        composeEnumerationCore("type", element.getTypeElement(), new Subscription.SubscriptionChannelTypeEnumFactory(), false);
39968        composeEnumerationExtras("type", element.getTypeElement(), new Subscription.SubscriptionChannelTypeEnumFactory(), false);
39969      }
39970      if (element.hasEndpointElement()) {
39971        composeUriCore("endpoint", element.getEndpointElement(), false);
39972        composeUriExtras("endpoint", element.getEndpointElement(), false);
39973      }
39974      if (element.hasPayloadElement()) {
39975        composeStringCore("payload", element.getPayloadElement(), false);
39976        composeStringExtras("payload", element.getPayloadElement(), false);
39977      }
39978      if (element.hasHeader()) {
39979        openArray("header");
39980        for (StringType e : element.getHeader()) 
39981          composeStringCore(null, e, true);
39982        closeArray();
39983        if (anyHasExtras(element.getHeader())) {
39984          openArray("_header");
39985          for (StringType e : element.getHeader()) 
39986            composeStringExtras(null, e, true);
39987          closeArray();
39988        }
39989      };
39990  }
39991
39992  protected void composeSubstance(String name, Substance element) throws IOException {
39993    if (element != null) {
39994      prop("resourceType", name);
39995      composeSubstanceInner(element);
39996    }
39997  }
39998
39999  protected void composeSubstanceInner(Substance element) throws IOException {
40000      composeDomainResourceElements(element);
40001      if (element.hasIdentifier()) {
40002        openArray("identifier");
40003        for (Identifier e : element.getIdentifier()) 
40004          composeIdentifier(null, e);
40005        closeArray();
40006      };
40007      if (element.hasStatusElement()) {
40008        composeEnumerationCore("status", element.getStatusElement(), new Substance.FHIRSubstanceStatusEnumFactory(), false);
40009        composeEnumerationExtras("status", element.getStatusElement(), new Substance.FHIRSubstanceStatusEnumFactory(), false);
40010      }
40011      if (element.hasCategory()) {
40012        openArray("category");
40013        for (CodeableConcept e : element.getCategory()) 
40014          composeCodeableConcept(null, e);
40015        closeArray();
40016      };
40017      if (element.hasCode()) {
40018        composeCodeableConcept("code", element.getCode());
40019      }
40020      if (element.hasDescriptionElement()) {
40021        composeStringCore("description", element.getDescriptionElement(), false);
40022        composeStringExtras("description", element.getDescriptionElement(), false);
40023      }
40024      if (element.hasInstance()) {
40025        openArray("instance");
40026        for (Substance.SubstanceInstanceComponent e : element.getInstance()) 
40027          composeSubstanceSubstanceInstanceComponent(null, e);
40028        closeArray();
40029      };
40030      if (element.hasIngredient()) {
40031        openArray("ingredient");
40032        for (Substance.SubstanceIngredientComponent e : element.getIngredient()) 
40033          composeSubstanceSubstanceIngredientComponent(null, e);
40034        closeArray();
40035      };
40036  }
40037
40038  protected void composeSubstanceSubstanceInstanceComponent(String name, Substance.SubstanceInstanceComponent element) throws IOException {
40039    if (element != null) {
40040      open(name);
40041      composeSubstanceSubstanceInstanceComponentInner(element);
40042      close();
40043    }
40044  }
40045
40046  protected void composeSubstanceSubstanceInstanceComponentInner(Substance.SubstanceInstanceComponent element) throws IOException {
40047      composeBackbone(element);
40048      if (element.hasIdentifier()) {
40049        composeIdentifier("identifier", element.getIdentifier());
40050      }
40051      if (element.hasExpiryElement()) {
40052        composeDateTimeCore("expiry", element.getExpiryElement(), false);
40053        composeDateTimeExtras("expiry", element.getExpiryElement(), false);
40054      }
40055      if (element.hasQuantity()) {
40056        composeSimpleQuantity("quantity", element.getQuantity());
40057      }
40058  }
40059
40060  protected void composeSubstanceSubstanceIngredientComponent(String name, Substance.SubstanceIngredientComponent element) throws IOException {
40061    if (element != null) {
40062      open(name);
40063      composeSubstanceSubstanceIngredientComponentInner(element);
40064      close();
40065    }
40066  }
40067
40068  protected void composeSubstanceSubstanceIngredientComponentInner(Substance.SubstanceIngredientComponent element) throws IOException {
40069      composeBackbone(element);
40070      if (element.hasQuantity()) {
40071        composeRatio("quantity", element.getQuantity());
40072      }
40073      if (element.hasSubstance()) {
40074        composeType("substance", element.getSubstance());
40075      }
40076  }
40077
40078  protected void composeSupplyDelivery(String name, SupplyDelivery element) throws IOException {
40079    if (element != null) {
40080      prop("resourceType", name);
40081      composeSupplyDeliveryInner(element);
40082    }
40083  }
40084
40085  protected void composeSupplyDeliveryInner(SupplyDelivery element) throws IOException {
40086      composeDomainResourceElements(element);
40087      if (element.hasIdentifier()) {
40088        composeIdentifier("identifier", element.getIdentifier());
40089      }
40090      if (element.hasBasedOn()) {
40091        openArray("basedOn");
40092        for (Reference e : element.getBasedOn()) 
40093          composeReference(null, e);
40094        closeArray();
40095      };
40096      if (element.hasPartOf()) {
40097        openArray("partOf");
40098        for (Reference e : element.getPartOf()) 
40099          composeReference(null, e);
40100        closeArray();
40101      };
40102      if (element.hasStatusElement()) {
40103        composeEnumerationCore("status", element.getStatusElement(), new SupplyDelivery.SupplyDeliveryStatusEnumFactory(), false);
40104        composeEnumerationExtras("status", element.getStatusElement(), new SupplyDelivery.SupplyDeliveryStatusEnumFactory(), false);
40105      }
40106      if (element.hasPatient()) {
40107        composeReference("patient", element.getPatient());
40108      }
40109      if (element.hasType()) {
40110        composeCodeableConcept("type", element.getType());
40111      }
40112      if (element.hasSuppliedItem()) {
40113        composeSupplyDeliverySupplyDeliverySuppliedItemComponent("suppliedItem", element.getSuppliedItem());
40114      }
40115      if (element.hasOccurrence()) {
40116        composeType("occurrence", element.getOccurrence());
40117      }
40118      if (element.hasSupplier()) {
40119        composeReference("supplier", element.getSupplier());
40120      }
40121      if (element.hasDestination()) {
40122        composeReference("destination", element.getDestination());
40123      }
40124      if (element.hasReceiver()) {
40125        openArray("receiver");
40126        for (Reference e : element.getReceiver()) 
40127          composeReference(null, e);
40128        closeArray();
40129      };
40130  }
40131
40132  protected void composeSupplyDeliverySupplyDeliverySuppliedItemComponent(String name, SupplyDelivery.SupplyDeliverySuppliedItemComponent element) throws IOException {
40133    if (element != null) {
40134      open(name);
40135      composeSupplyDeliverySupplyDeliverySuppliedItemComponentInner(element);
40136      close();
40137    }
40138  }
40139
40140  protected void composeSupplyDeliverySupplyDeliverySuppliedItemComponentInner(SupplyDelivery.SupplyDeliverySuppliedItemComponent element) throws IOException {
40141      composeBackbone(element);
40142      if (element.hasQuantity()) {
40143        composeSimpleQuantity("quantity", element.getQuantity());
40144      }
40145      if (element.hasItem()) {
40146        composeType("item", element.getItem());
40147      }
40148  }
40149
40150  protected void composeSupplyRequest(String name, SupplyRequest element) throws IOException {
40151    if (element != null) {
40152      prop("resourceType", name);
40153      composeSupplyRequestInner(element);
40154    }
40155  }
40156
40157  protected void composeSupplyRequestInner(SupplyRequest element) throws IOException {
40158      composeDomainResourceElements(element);
40159      if (element.hasIdentifier()) {
40160        composeIdentifier("identifier", element.getIdentifier());
40161      }
40162      if (element.hasStatusElement()) {
40163        composeEnumerationCore("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory(), false);
40164        composeEnumerationExtras("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory(), false);
40165      }
40166      if (element.hasCategory()) {
40167        composeCodeableConcept("category", element.getCategory());
40168      }
40169      if (element.hasPriorityElement()) {
40170        composeEnumerationCore("priority", element.getPriorityElement(), new SupplyRequest.RequestPriorityEnumFactory(), false);
40171        composeEnumerationExtras("priority", element.getPriorityElement(), new SupplyRequest.RequestPriorityEnumFactory(), false);
40172      }
40173      if (element.hasOrderedItem()) {
40174        composeSupplyRequestSupplyRequestOrderedItemComponent("orderedItem", element.getOrderedItem());
40175      }
40176      if (element.hasOccurrence()) {
40177        composeType("occurrence", element.getOccurrence());
40178      }
40179      if (element.hasAuthoredOnElement()) {
40180        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
40181        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
40182      }
40183      if (element.hasRequester()) {
40184        composeSupplyRequestSupplyRequestRequesterComponent("requester", element.getRequester());
40185      }
40186      if (element.hasSupplier()) {
40187        openArray("supplier");
40188        for (Reference e : element.getSupplier()) 
40189          composeReference(null, e);
40190        closeArray();
40191      };
40192      if (element.hasReason()) {
40193        composeType("reason", element.getReason());
40194      }
40195      if (element.hasDeliverFrom()) {
40196        composeReference("deliverFrom", element.getDeliverFrom());
40197      }
40198      if (element.hasDeliverTo()) {
40199        composeReference("deliverTo", element.getDeliverTo());
40200      }
40201  }
40202
40203  protected void composeSupplyRequestSupplyRequestOrderedItemComponent(String name, SupplyRequest.SupplyRequestOrderedItemComponent element) throws IOException {
40204    if (element != null) {
40205      open(name);
40206      composeSupplyRequestSupplyRequestOrderedItemComponentInner(element);
40207      close();
40208    }
40209  }
40210
40211  protected void composeSupplyRequestSupplyRequestOrderedItemComponentInner(SupplyRequest.SupplyRequestOrderedItemComponent element) throws IOException {
40212      composeBackbone(element);
40213      if (element.hasQuantity()) {
40214        composeQuantity("quantity", element.getQuantity());
40215      }
40216      if (element.hasItem()) {
40217        composeType("item", element.getItem());
40218      }
40219  }
40220
40221  protected void composeSupplyRequestSupplyRequestRequesterComponent(String name, SupplyRequest.SupplyRequestRequesterComponent element) throws IOException {
40222    if (element != null) {
40223      open(name);
40224      composeSupplyRequestSupplyRequestRequesterComponentInner(element);
40225      close();
40226    }
40227  }
40228
40229  protected void composeSupplyRequestSupplyRequestRequesterComponentInner(SupplyRequest.SupplyRequestRequesterComponent element) throws IOException {
40230      composeBackbone(element);
40231      if (element.hasAgent()) {
40232        composeReference("agent", element.getAgent());
40233      }
40234      if (element.hasOnBehalfOf()) {
40235        composeReference("onBehalfOf", element.getOnBehalfOf());
40236      }
40237  }
40238
40239  protected void composeTask(String name, Task element) throws IOException {
40240    if (element != null) {
40241      prop("resourceType", name);
40242      composeTaskInner(element);
40243    }
40244  }
40245
40246  protected void composeTaskInner(Task element) throws IOException {
40247      composeDomainResourceElements(element);
40248      if (element.hasIdentifier()) {
40249        openArray("identifier");
40250        for (Identifier e : element.getIdentifier()) 
40251          composeIdentifier(null, e);
40252        closeArray();
40253      };
40254      if (element.hasDefinition()) {
40255        composeType("definition", element.getDefinition());
40256      }
40257      if (element.hasBasedOn()) {
40258        openArray("basedOn");
40259        for (Reference e : element.getBasedOn()) 
40260          composeReference(null, e);
40261        closeArray();
40262      };
40263      if (element.hasGroupIdentifier()) {
40264        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
40265      }
40266      if (element.hasPartOf()) {
40267        openArray("partOf");
40268        for (Reference e : element.getPartOf()) 
40269          composeReference(null, e);
40270        closeArray();
40271      };
40272      if (element.hasStatusElement()) {
40273        composeEnumerationCore("status", element.getStatusElement(), new Task.TaskStatusEnumFactory(), false);
40274        composeEnumerationExtras("status", element.getStatusElement(), new Task.TaskStatusEnumFactory(), false);
40275      }
40276      if (element.hasStatusReason()) {
40277        composeCodeableConcept("statusReason", element.getStatusReason());
40278      }
40279      if (element.hasBusinessStatus()) {
40280        composeCodeableConcept("businessStatus", element.getBusinessStatus());
40281      }
40282      if (element.hasIntentElement()) {
40283        composeEnumerationCore("intent", element.getIntentElement(), new Task.TaskIntentEnumFactory(), false);
40284        composeEnumerationExtras("intent", element.getIntentElement(), new Task.TaskIntentEnumFactory(), false);
40285      }
40286      if (element.hasPriorityElement()) {
40287        composeEnumerationCore("priority", element.getPriorityElement(), new Task.TaskPriorityEnumFactory(), false);
40288        composeEnumerationExtras("priority", element.getPriorityElement(), new Task.TaskPriorityEnumFactory(), false);
40289      }
40290      if (element.hasCode()) {
40291        composeCodeableConcept("code", element.getCode());
40292      }
40293      if (element.hasDescriptionElement()) {
40294        composeStringCore("description", element.getDescriptionElement(), false);
40295        composeStringExtras("description", element.getDescriptionElement(), false);
40296      }
40297      if (element.hasFocus()) {
40298        composeReference("focus", element.getFocus());
40299      }
40300      if (element.hasFor()) {
40301        composeReference("for", element.getFor());
40302      }
40303      if (element.hasContext()) {
40304        composeReference("context", element.getContext());
40305      }
40306      if (element.hasExecutionPeriod()) {
40307        composePeriod("executionPeriod", element.getExecutionPeriod());
40308      }
40309      if (element.hasAuthoredOnElement()) {
40310        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
40311        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
40312      }
40313      if (element.hasLastModifiedElement()) {
40314        composeDateTimeCore("lastModified", element.getLastModifiedElement(), false);
40315        composeDateTimeExtras("lastModified", element.getLastModifiedElement(), false);
40316      }
40317      if (element.hasRequester()) {
40318        composeTaskTaskRequesterComponent("requester", element.getRequester());
40319      }
40320      if (element.hasPerformerType()) {
40321        openArray("performerType");
40322        for (CodeableConcept e : element.getPerformerType()) 
40323          composeCodeableConcept(null, e);
40324        closeArray();
40325      };
40326      if (element.hasOwner()) {
40327        composeReference("owner", element.getOwner());
40328      }
40329      if (element.hasReason()) {
40330        composeCodeableConcept("reason", element.getReason());
40331      }
40332      if (element.hasNote()) {
40333        openArray("note");
40334        for (Annotation e : element.getNote()) 
40335          composeAnnotation(null, e);
40336        closeArray();
40337      };
40338      if (element.hasRelevantHistory()) {
40339        openArray("relevantHistory");
40340        for (Reference e : element.getRelevantHistory()) 
40341          composeReference(null, e);
40342        closeArray();
40343      };
40344      if (element.hasRestriction()) {
40345        composeTaskTaskRestrictionComponent("restriction", element.getRestriction());
40346      }
40347      if (element.hasInput()) {
40348        openArray("input");
40349        for (Task.ParameterComponent e : element.getInput()) 
40350          composeTaskParameterComponent(null, e);
40351        closeArray();
40352      };
40353      if (element.hasOutput()) {
40354        openArray("output");
40355        for (Task.TaskOutputComponent e : element.getOutput()) 
40356          composeTaskTaskOutputComponent(null, e);
40357        closeArray();
40358      };
40359  }
40360
40361  protected void composeTaskTaskRequesterComponent(String name, Task.TaskRequesterComponent element) throws IOException {
40362    if (element != null) {
40363      open(name);
40364      composeTaskTaskRequesterComponentInner(element);
40365      close();
40366    }
40367  }
40368
40369  protected void composeTaskTaskRequesterComponentInner(Task.TaskRequesterComponent element) throws IOException {
40370      composeBackbone(element);
40371      if (element.hasAgent()) {
40372        composeReference("agent", element.getAgent());
40373      }
40374      if (element.hasOnBehalfOf()) {
40375        composeReference("onBehalfOf", element.getOnBehalfOf());
40376      }
40377  }
40378
40379  protected void composeTaskTaskRestrictionComponent(String name, Task.TaskRestrictionComponent element) throws IOException {
40380    if (element != null) {
40381      open(name);
40382      composeTaskTaskRestrictionComponentInner(element);
40383      close();
40384    }
40385  }
40386
40387  protected void composeTaskTaskRestrictionComponentInner(Task.TaskRestrictionComponent element) throws IOException {
40388      composeBackbone(element);
40389      if (element.hasRepetitionsElement()) {
40390        composePositiveIntCore("repetitions", element.getRepetitionsElement(), false);
40391        composePositiveIntExtras("repetitions", element.getRepetitionsElement(), false);
40392      }
40393      if (element.hasPeriod()) {
40394        composePeriod("period", element.getPeriod());
40395      }
40396      if (element.hasRecipient()) {
40397        openArray("recipient");
40398        for (Reference e : element.getRecipient()) 
40399          composeReference(null, e);
40400        closeArray();
40401      };
40402  }
40403
40404  protected void composeTaskParameterComponent(String name, Task.ParameterComponent element) throws IOException {
40405    if (element != null) {
40406      open(name);
40407      composeTaskParameterComponentInner(element);
40408      close();
40409    }
40410  }
40411
40412  protected void composeTaskParameterComponentInner(Task.ParameterComponent element) throws IOException {
40413      composeBackbone(element);
40414      if (element.hasType()) {
40415        composeCodeableConcept("type", element.getType());
40416      }
40417      if (element.hasValue()) {
40418        composeType("value", element.getValue());
40419      }
40420  }
40421
40422  protected void composeTaskTaskOutputComponent(String name, Task.TaskOutputComponent element) throws IOException {
40423    if (element != null) {
40424      open(name);
40425      composeTaskTaskOutputComponentInner(element);
40426      close();
40427    }
40428  }
40429
40430  protected void composeTaskTaskOutputComponentInner(Task.TaskOutputComponent element) throws IOException {
40431      composeBackbone(element);
40432      if (element.hasType()) {
40433        composeCodeableConcept("type", element.getType());
40434      }
40435      if (element.hasValue()) {
40436        composeType("value", element.getValue());
40437      }
40438  }
40439
40440  protected void composeTestReport(String name, TestReport element) throws IOException {
40441    if (element != null) {
40442      prop("resourceType", name);
40443      composeTestReportInner(element);
40444    }
40445  }
40446
40447  protected void composeTestReportInner(TestReport element) throws IOException {
40448      composeDomainResourceElements(element);
40449      if (element.hasIdentifier()) {
40450        composeIdentifier("identifier", element.getIdentifier());
40451      }
40452      if (element.hasNameElement()) {
40453        composeStringCore("name", element.getNameElement(), false);
40454        composeStringExtras("name", element.getNameElement(), false);
40455      }
40456      if (element.hasStatusElement()) {
40457        composeEnumerationCore("status", element.getStatusElement(), new TestReport.TestReportStatusEnumFactory(), false);
40458        composeEnumerationExtras("status", element.getStatusElement(), new TestReport.TestReportStatusEnumFactory(), false);
40459      }
40460      if (element.hasTestScript()) {
40461        composeReference("testScript", element.getTestScript());
40462      }
40463      if (element.hasResultElement()) {
40464        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportResultEnumFactory(), false);
40465        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportResultEnumFactory(), false);
40466      }
40467      if (element.hasScoreElement()) {
40468        composeDecimalCore("score", element.getScoreElement(), false);
40469        composeDecimalExtras("score", element.getScoreElement(), false);
40470      }
40471      if (element.hasTesterElement()) {
40472        composeStringCore("tester", element.getTesterElement(), false);
40473        composeStringExtras("tester", element.getTesterElement(), false);
40474      }
40475      if (element.hasIssuedElement()) {
40476        composeDateTimeCore("issued", element.getIssuedElement(), false);
40477        composeDateTimeExtras("issued", element.getIssuedElement(), false);
40478      }
40479      if (element.hasParticipant()) {
40480        openArray("participant");
40481        for (TestReport.TestReportParticipantComponent e : element.getParticipant()) 
40482          composeTestReportTestReportParticipantComponent(null, e);
40483        closeArray();
40484      };
40485      if (element.hasSetup()) {
40486        composeTestReportTestReportSetupComponent("setup", element.getSetup());
40487      }
40488      if (element.hasTest()) {
40489        openArray("test");
40490        for (TestReport.TestReportTestComponent e : element.getTest()) 
40491          composeTestReportTestReportTestComponent(null, e);
40492        closeArray();
40493      };
40494      if (element.hasTeardown()) {
40495        composeTestReportTestReportTeardownComponent("teardown", element.getTeardown());
40496      }
40497  }
40498
40499  protected void composeTestReportTestReportParticipantComponent(String name, TestReport.TestReportParticipantComponent element) throws IOException {
40500    if (element != null) {
40501      open(name);
40502      composeTestReportTestReportParticipantComponentInner(element);
40503      close();
40504    }
40505  }
40506
40507  protected void composeTestReportTestReportParticipantComponentInner(TestReport.TestReportParticipantComponent element) throws IOException {
40508      composeBackbone(element);
40509      if (element.hasTypeElement()) {
40510        composeEnumerationCore("type", element.getTypeElement(), new TestReport.TestReportParticipantTypeEnumFactory(), false);
40511        composeEnumerationExtras("type", element.getTypeElement(), new TestReport.TestReportParticipantTypeEnumFactory(), false);
40512      }
40513      if (element.hasUriElement()) {
40514        composeUriCore("uri", element.getUriElement(), false);
40515        composeUriExtras("uri", element.getUriElement(), false);
40516      }
40517      if (element.hasDisplayElement()) {
40518        composeStringCore("display", element.getDisplayElement(), false);
40519        composeStringExtras("display", element.getDisplayElement(), false);
40520      }
40521  }
40522
40523  protected void composeTestReportTestReportSetupComponent(String name, TestReport.TestReportSetupComponent element) throws IOException {
40524    if (element != null) {
40525      open(name);
40526      composeTestReportTestReportSetupComponentInner(element);
40527      close();
40528    }
40529  }
40530
40531  protected void composeTestReportTestReportSetupComponentInner(TestReport.TestReportSetupComponent element) throws IOException {
40532      composeBackbone(element);
40533      if (element.hasAction()) {
40534        openArray("action");
40535        for (TestReport.SetupActionComponent e : element.getAction()) 
40536          composeTestReportSetupActionComponent(null, e);
40537        closeArray();
40538      };
40539  }
40540
40541  protected void composeTestReportSetupActionComponent(String name, TestReport.SetupActionComponent element) throws IOException {
40542    if (element != null) {
40543      open(name);
40544      composeTestReportSetupActionComponentInner(element);
40545      close();
40546    }
40547  }
40548
40549  protected void composeTestReportSetupActionComponentInner(TestReport.SetupActionComponent element) throws IOException {
40550      composeBackbone(element);
40551      if (element.hasOperation()) {
40552        composeTestReportSetupActionOperationComponent("operation", element.getOperation());
40553      }
40554      if (element.hasAssert()) {
40555        composeTestReportSetupActionAssertComponent("assert", element.getAssert());
40556      }
40557  }
40558
40559  protected void composeTestReportSetupActionOperationComponent(String name, TestReport.SetupActionOperationComponent element) throws IOException {
40560    if (element != null) {
40561      open(name);
40562      composeTestReportSetupActionOperationComponentInner(element);
40563      close();
40564    }
40565  }
40566
40567  protected void composeTestReportSetupActionOperationComponentInner(TestReport.SetupActionOperationComponent element) throws IOException {
40568      composeBackbone(element);
40569      if (element.hasResultElement()) {
40570        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
40571        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
40572      }
40573      if (element.hasMessageElement()) {
40574        composeMarkdownCore("message", element.getMessageElement(), false);
40575        composeMarkdownExtras("message", element.getMessageElement(), false);
40576      }
40577      if (element.hasDetailElement()) {
40578        composeUriCore("detail", element.getDetailElement(), false);
40579        composeUriExtras("detail", element.getDetailElement(), false);
40580      }
40581  }
40582
40583  protected void composeTestReportSetupActionAssertComponent(String name, TestReport.SetupActionAssertComponent element) throws IOException {
40584    if (element != null) {
40585      open(name);
40586      composeTestReportSetupActionAssertComponentInner(element);
40587      close();
40588    }
40589  }
40590
40591  protected void composeTestReportSetupActionAssertComponentInner(TestReport.SetupActionAssertComponent element) throws IOException {
40592      composeBackbone(element);
40593      if (element.hasResultElement()) {
40594        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
40595        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
40596      }
40597      if (element.hasMessageElement()) {
40598        composeMarkdownCore("message", element.getMessageElement(), false);
40599        composeMarkdownExtras("message", element.getMessageElement(), false);
40600      }
40601      if (element.hasDetailElement()) {
40602        composeStringCore("detail", element.getDetailElement(), false);
40603        composeStringExtras("detail", element.getDetailElement(), false);
40604      }
40605  }
40606
40607  protected void composeTestReportTestReportTestComponent(String name, TestReport.TestReportTestComponent element) throws IOException {
40608    if (element != null) {
40609      open(name);
40610      composeTestReportTestReportTestComponentInner(element);
40611      close();
40612    }
40613  }
40614
40615  protected void composeTestReportTestReportTestComponentInner(TestReport.TestReportTestComponent element) throws IOException {
40616      composeBackbone(element);
40617      if (element.hasNameElement()) {
40618        composeStringCore("name", element.getNameElement(), false);
40619        composeStringExtras("name", element.getNameElement(), false);
40620      }
40621      if (element.hasDescriptionElement()) {
40622        composeStringCore("description", element.getDescriptionElement(), false);
40623        composeStringExtras("description", element.getDescriptionElement(), false);
40624      }
40625      if (element.hasAction()) {
40626        openArray("action");
40627        for (TestReport.TestActionComponent e : element.getAction()) 
40628          composeTestReportTestActionComponent(null, e);
40629        closeArray();
40630      };
40631  }
40632
40633  protected void composeTestReportTestActionComponent(String name, TestReport.TestActionComponent element) throws IOException {
40634    if (element != null) {
40635      open(name);
40636      composeTestReportTestActionComponentInner(element);
40637      close();
40638    }
40639  }
40640
40641  protected void composeTestReportTestActionComponentInner(TestReport.TestActionComponent element) throws IOException {
40642      composeBackbone(element);
40643      if (element.hasOperation()) {
40644        composeTestReportSetupActionOperationComponent("operation", element.getOperation());
40645      }
40646      if (element.hasAssert()) {
40647        composeTestReportSetupActionAssertComponent("assert", element.getAssert());
40648      }
40649  }
40650
40651  protected void composeTestReportTestReportTeardownComponent(String name, TestReport.TestReportTeardownComponent element) throws IOException {
40652    if (element != null) {
40653      open(name);
40654      composeTestReportTestReportTeardownComponentInner(element);
40655      close();
40656    }
40657  }
40658
40659  protected void composeTestReportTestReportTeardownComponentInner(TestReport.TestReportTeardownComponent element) throws IOException {
40660      composeBackbone(element);
40661      if (element.hasAction()) {
40662        openArray("action");
40663        for (TestReport.TeardownActionComponent e : element.getAction()) 
40664          composeTestReportTeardownActionComponent(null, e);
40665        closeArray();
40666      };
40667  }
40668
40669  protected void composeTestReportTeardownActionComponent(String name, TestReport.TeardownActionComponent element) throws IOException {
40670    if (element != null) {
40671      open(name);
40672      composeTestReportTeardownActionComponentInner(element);
40673      close();
40674    }
40675  }
40676
40677  protected void composeTestReportTeardownActionComponentInner(TestReport.TeardownActionComponent element) throws IOException {
40678      composeBackbone(element);
40679      if (element.hasOperation()) {
40680        composeTestReportSetupActionOperationComponent("operation", element.getOperation());
40681      }
40682  }
40683
40684  protected void composeTestScript(String name, TestScript element) throws IOException {
40685    if (element != null) {
40686      prop("resourceType", name);
40687      composeTestScriptInner(element);
40688    }
40689  }
40690
40691  protected void composeTestScriptInner(TestScript element) throws IOException {
40692      composeDomainResourceElements(element);
40693      if (element.hasUrlElement()) {
40694        composeUriCore("url", element.getUrlElement(), false);
40695        composeUriExtras("url", element.getUrlElement(), false);
40696      }
40697      if (element.hasIdentifier()) {
40698        composeIdentifier("identifier", element.getIdentifier());
40699      }
40700      if (element.hasVersionElement()) {
40701        composeStringCore("version", element.getVersionElement(), false);
40702        composeStringExtras("version", element.getVersionElement(), false);
40703      }
40704      if (element.hasNameElement()) {
40705        composeStringCore("name", element.getNameElement(), false);
40706        composeStringExtras("name", element.getNameElement(), false);
40707      }
40708      if (element.hasTitleElement()) {
40709        composeStringCore("title", element.getTitleElement(), false);
40710        composeStringExtras("title", element.getTitleElement(), false);
40711      }
40712      if (element.hasStatusElement()) {
40713        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
40714        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
40715      }
40716      if (element.hasExperimentalElement()) {
40717        composeBooleanCore("experimental", element.getExperimentalElement(), false);
40718        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
40719      }
40720      if (element.hasDateElement()) {
40721        composeDateTimeCore("date", element.getDateElement(), false);
40722        composeDateTimeExtras("date", element.getDateElement(), false);
40723      }
40724      if (element.hasPublisherElement()) {
40725        composeStringCore("publisher", element.getPublisherElement(), false);
40726        composeStringExtras("publisher", element.getPublisherElement(), false);
40727      }
40728      if (element.hasContact()) {
40729        openArray("contact");
40730        for (ContactDetail e : element.getContact()) 
40731          composeContactDetail(null, e);
40732        closeArray();
40733      };
40734      if (element.hasDescriptionElement()) {
40735        composeMarkdownCore("description", element.getDescriptionElement(), false);
40736        composeMarkdownExtras("description", element.getDescriptionElement(), false);
40737      }
40738      if (element.hasUseContext()) {
40739        openArray("useContext");
40740        for (UsageContext e : element.getUseContext()) 
40741          composeUsageContext(null, e);
40742        closeArray();
40743      };
40744      if (element.hasJurisdiction()) {
40745        openArray("jurisdiction");
40746        for (CodeableConcept e : element.getJurisdiction()) 
40747          composeCodeableConcept(null, e);
40748        closeArray();
40749      };
40750      if (element.hasPurposeElement()) {
40751        composeMarkdownCore("purpose", element.getPurposeElement(), false);
40752        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
40753      }
40754      if (element.hasCopyrightElement()) {
40755        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
40756        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
40757      }
40758      if (element.hasOrigin()) {
40759        openArray("origin");
40760        for (TestScript.TestScriptOriginComponent e : element.getOrigin()) 
40761          composeTestScriptTestScriptOriginComponent(null, e);
40762        closeArray();
40763      };
40764      if (element.hasDestination()) {
40765        openArray("destination");
40766        for (TestScript.TestScriptDestinationComponent e : element.getDestination()) 
40767          composeTestScriptTestScriptDestinationComponent(null, e);
40768        closeArray();
40769      };
40770      if (element.hasMetadata()) {
40771        composeTestScriptTestScriptMetadataComponent("metadata", element.getMetadata());
40772      }
40773      if (element.hasFixture()) {
40774        openArray("fixture");
40775        for (TestScript.TestScriptFixtureComponent e : element.getFixture()) 
40776          composeTestScriptTestScriptFixtureComponent(null, e);
40777        closeArray();
40778      };
40779      if (element.hasProfile()) {
40780        openArray("profile");
40781        for (Reference e : element.getProfile()) 
40782          composeReference(null, e);
40783        closeArray();
40784      };
40785      if (element.hasVariable()) {
40786        openArray("variable");
40787        for (TestScript.TestScriptVariableComponent e : element.getVariable()) 
40788          composeTestScriptTestScriptVariableComponent(null, e);
40789        closeArray();
40790      };
40791      if (element.hasRule()) {
40792        openArray("rule");
40793        for (TestScript.TestScriptRuleComponent e : element.getRule()) 
40794          composeTestScriptTestScriptRuleComponent(null, e);
40795        closeArray();
40796      };
40797      if (element.hasRuleset()) {
40798        openArray("ruleset");
40799        for (TestScript.TestScriptRulesetComponent e : element.getRuleset()) 
40800          composeTestScriptTestScriptRulesetComponent(null, e);
40801        closeArray();
40802      };
40803      if (element.hasSetup()) {
40804        composeTestScriptTestScriptSetupComponent("setup", element.getSetup());
40805      }
40806      if (element.hasTest()) {
40807        openArray("test");
40808        for (TestScript.TestScriptTestComponent e : element.getTest()) 
40809          composeTestScriptTestScriptTestComponent(null, e);
40810        closeArray();
40811      };
40812      if (element.hasTeardown()) {
40813        composeTestScriptTestScriptTeardownComponent("teardown", element.getTeardown());
40814      }
40815  }
40816
40817  protected void composeTestScriptTestScriptOriginComponent(String name, TestScript.TestScriptOriginComponent element) throws IOException {
40818    if (element != null) {
40819      open(name);
40820      composeTestScriptTestScriptOriginComponentInner(element);
40821      close();
40822    }
40823  }
40824
40825  protected void composeTestScriptTestScriptOriginComponentInner(TestScript.TestScriptOriginComponent element) throws IOException {
40826      composeBackbone(element);
40827      if (element.hasIndexElement()) {
40828        composeIntegerCore("index", element.getIndexElement(), false);
40829        composeIntegerExtras("index", element.getIndexElement(), false);
40830      }
40831      if (element.hasProfile()) {
40832        composeCoding("profile", element.getProfile());
40833      }
40834  }
40835
40836  protected void composeTestScriptTestScriptDestinationComponent(String name, TestScript.TestScriptDestinationComponent element) throws IOException {
40837    if (element != null) {
40838      open(name);
40839      composeTestScriptTestScriptDestinationComponentInner(element);
40840      close();
40841    }
40842  }
40843
40844  protected void composeTestScriptTestScriptDestinationComponentInner(TestScript.TestScriptDestinationComponent element) throws IOException {
40845      composeBackbone(element);
40846      if (element.hasIndexElement()) {
40847        composeIntegerCore("index", element.getIndexElement(), false);
40848        composeIntegerExtras("index", element.getIndexElement(), false);
40849      }
40850      if (element.hasProfile()) {
40851        composeCoding("profile", element.getProfile());
40852      }
40853  }
40854
40855  protected void composeTestScriptTestScriptMetadataComponent(String name, TestScript.TestScriptMetadataComponent element) throws IOException {
40856    if (element != null) {
40857      open(name);
40858      composeTestScriptTestScriptMetadataComponentInner(element);
40859      close();
40860    }
40861  }
40862
40863  protected void composeTestScriptTestScriptMetadataComponentInner(TestScript.TestScriptMetadataComponent element) throws IOException {
40864      composeBackbone(element);
40865      if (element.hasLink()) {
40866        openArray("link");
40867        for (TestScript.TestScriptMetadataLinkComponent e : element.getLink()) 
40868          composeTestScriptTestScriptMetadataLinkComponent(null, e);
40869        closeArray();
40870      };
40871      if (element.hasCapability()) {
40872        openArray("capability");
40873        for (TestScript.TestScriptMetadataCapabilityComponent e : element.getCapability()) 
40874          composeTestScriptTestScriptMetadataCapabilityComponent(null, e);
40875        closeArray();
40876      };
40877  }
40878
40879  protected void composeTestScriptTestScriptMetadataLinkComponent(String name, TestScript.TestScriptMetadataLinkComponent element) throws IOException {
40880    if (element != null) {
40881      open(name);
40882      composeTestScriptTestScriptMetadataLinkComponentInner(element);
40883      close();
40884    }
40885  }
40886
40887  protected void composeTestScriptTestScriptMetadataLinkComponentInner(TestScript.TestScriptMetadataLinkComponent element) throws IOException {
40888      composeBackbone(element);
40889      if (element.hasUrlElement()) {
40890        composeUriCore("url", element.getUrlElement(), false);
40891        composeUriExtras("url", element.getUrlElement(), false);
40892      }
40893      if (element.hasDescriptionElement()) {
40894        composeStringCore("description", element.getDescriptionElement(), false);
40895        composeStringExtras("description", element.getDescriptionElement(), false);
40896      }
40897  }
40898
40899  protected void composeTestScriptTestScriptMetadataCapabilityComponent(String name, TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
40900    if (element != null) {
40901      open(name);
40902      composeTestScriptTestScriptMetadataCapabilityComponentInner(element);
40903      close();
40904    }
40905  }
40906
40907  protected void composeTestScriptTestScriptMetadataCapabilityComponentInner(TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
40908      composeBackbone(element);
40909      if (element.hasRequiredElement()) {
40910        composeBooleanCore("required", element.getRequiredElement(), false);
40911        composeBooleanExtras("required", element.getRequiredElement(), false);
40912      }
40913      if (element.hasValidatedElement()) {
40914        composeBooleanCore("validated", element.getValidatedElement(), false);
40915        composeBooleanExtras("validated", element.getValidatedElement(), false);
40916      }
40917      if (element.hasDescriptionElement()) {
40918        composeStringCore("description", element.getDescriptionElement(), false);
40919        composeStringExtras("description", element.getDescriptionElement(), false);
40920      }
40921      if (element.hasOrigin()) {
40922        openArray("origin");
40923        for (IntegerType e : element.getOrigin()) 
40924          composeIntegerCore(null, e, true);
40925        closeArray();
40926        if (anyHasExtras(element.getOrigin())) {
40927          openArray("_origin");
40928          for (IntegerType e : element.getOrigin()) 
40929            composeIntegerExtras(null, e, true);
40930          closeArray();
40931        }
40932      };
40933      if (element.hasDestinationElement()) {
40934        composeIntegerCore("destination", element.getDestinationElement(), false);
40935        composeIntegerExtras("destination", element.getDestinationElement(), false);
40936      }
40937      if (element.hasLink()) {
40938        openArray("link");
40939        for (UriType e : element.getLink()) 
40940          composeUriCore(null, e, true);
40941        closeArray();
40942        if (anyHasExtras(element.getLink())) {
40943          openArray("_link");
40944          for (UriType e : element.getLink()) 
40945            composeUriExtras(null, e, true);
40946          closeArray();
40947        }
40948      };
40949      if (element.hasCapabilities()) {
40950        composeReference("capabilities", element.getCapabilities());
40951      }
40952  }
40953
40954  protected void composeTestScriptTestScriptFixtureComponent(String name, TestScript.TestScriptFixtureComponent element) throws IOException {
40955    if (element != null) {
40956      open(name);
40957      composeTestScriptTestScriptFixtureComponentInner(element);
40958      close();
40959    }
40960  }
40961
40962  protected void composeTestScriptTestScriptFixtureComponentInner(TestScript.TestScriptFixtureComponent element) throws IOException {
40963      composeBackbone(element);
40964      if (element.hasAutocreateElement()) {
40965        composeBooleanCore("autocreate", element.getAutocreateElement(), false);
40966        composeBooleanExtras("autocreate", element.getAutocreateElement(), false);
40967      }
40968      if (element.hasAutodeleteElement()) {
40969        composeBooleanCore("autodelete", element.getAutodeleteElement(), false);
40970        composeBooleanExtras("autodelete", element.getAutodeleteElement(), false);
40971      }
40972      if (element.hasResource()) {
40973        composeReference("resource", element.getResource());
40974      }
40975  }
40976
40977  protected void composeTestScriptTestScriptVariableComponent(String name, TestScript.TestScriptVariableComponent element) throws IOException {
40978    if (element != null) {
40979      open(name);
40980      composeTestScriptTestScriptVariableComponentInner(element);
40981      close();
40982    }
40983  }
40984
40985  protected void composeTestScriptTestScriptVariableComponentInner(TestScript.TestScriptVariableComponent element) throws IOException {
40986      composeBackbone(element);
40987      if (element.hasNameElement()) {
40988        composeStringCore("name", element.getNameElement(), false);
40989        composeStringExtras("name", element.getNameElement(), false);
40990      }
40991      if (element.hasDefaultValueElement()) {
40992        composeStringCore("defaultValue", element.getDefaultValueElement(), false);
40993        composeStringExtras("defaultValue", element.getDefaultValueElement(), false);
40994      }
40995      if (element.hasDescriptionElement()) {
40996        composeStringCore("description", element.getDescriptionElement(), false);
40997        composeStringExtras("description", element.getDescriptionElement(), false);
40998      }
40999      if (element.hasExpressionElement()) {
41000        composeStringCore("expression", element.getExpressionElement(), false);
41001        composeStringExtras("expression", element.getExpressionElement(), false);
41002      }
41003      if (element.hasHeaderFieldElement()) {
41004        composeStringCore("headerField", element.getHeaderFieldElement(), false);
41005        composeStringExtras("headerField", element.getHeaderFieldElement(), false);
41006      }
41007      if (element.hasHintElement()) {
41008        composeStringCore("hint", element.getHintElement(), false);
41009        composeStringExtras("hint", element.getHintElement(), false);
41010      }
41011      if (element.hasPathElement()) {
41012        composeStringCore("path", element.getPathElement(), false);
41013        composeStringExtras("path", element.getPathElement(), false);
41014      }
41015      if (element.hasSourceIdElement()) {
41016        composeIdCore("sourceId", element.getSourceIdElement(), false);
41017        composeIdExtras("sourceId", element.getSourceIdElement(), false);
41018      }
41019  }
41020
41021  protected void composeTestScriptTestScriptRuleComponent(String name, TestScript.TestScriptRuleComponent element) throws IOException {
41022    if (element != null) {
41023      open(name);
41024      composeTestScriptTestScriptRuleComponentInner(element);
41025      close();
41026    }
41027  }
41028
41029  protected void composeTestScriptTestScriptRuleComponentInner(TestScript.TestScriptRuleComponent element) throws IOException {
41030      composeBackbone(element);
41031      if (element.hasResource()) {
41032        composeReference("resource", element.getResource());
41033      }
41034      if (element.hasParam()) {
41035        openArray("param");
41036        for (TestScript.RuleParamComponent e : element.getParam()) 
41037          composeTestScriptRuleParamComponent(null, e);
41038        closeArray();
41039      };
41040  }
41041
41042  protected void composeTestScriptRuleParamComponent(String name, TestScript.RuleParamComponent element) throws IOException {
41043    if (element != null) {
41044      open(name);
41045      composeTestScriptRuleParamComponentInner(element);
41046      close();
41047    }
41048  }
41049
41050  protected void composeTestScriptRuleParamComponentInner(TestScript.RuleParamComponent element) throws IOException {
41051      composeBackbone(element);
41052      if (element.hasNameElement()) {
41053        composeStringCore("name", element.getNameElement(), false);
41054        composeStringExtras("name", element.getNameElement(), false);
41055      }
41056      if (element.hasValueElement()) {
41057        composeStringCore("value", element.getValueElement(), false);
41058        composeStringExtras("value", element.getValueElement(), false);
41059      }
41060  }
41061
41062  protected void composeTestScriptTestScriptRulesetComponent(String name, TestScript.TestScriptRulesetComponent element) throws IOException {
41063    if (element != null) {
41064      open(name);
41065      composeTestScriptTestScriptRulesetComponentInner(element);
41066      close();
41067    }
41068  }
41069
41070  protected void composeTestScriptTestScriptRulesetComponentInner(TestScript.TestScriptRulesetComponent element) throws IOException {
41071      composeBackbone(element);
41072      if (element.hasResource()) {
41073        composeReference("resource", element.getResource());
41074      }
41075      if (element.hasRule()) {
41076        openArray("rule");
41077        for (TestScript.RulesetRuleComponent e : element.getRule()) 
41078          composeTestScriptRulesetRuleComponent(null, e);
41079        closeArray();
41080      };
41081  }
41082
41083  protected void composeTestScriptRulesetRuleComponent(String name, TestScript.RulesetRuleComponent element) throws IOException {
41084    if (element != null) {
41085      open(name);
41086      composeTestScriptRulesetRuleComponentInner(element);
41087      close();
41088    }
41089  }
41090
41091  protected void composeTestScriptRulesetRuleComponentInner(TestScript.RulesetRuleComponent element) throws IOException {
41092      composeBackbone(element);
41093      if (element.hasRuleIdElement()) {
41094        composeIdCore("ruleId", element.getRuleIdElement(), false);
41095        composeIdExtras("ruleId", element.getRuleIdElement(), false);
41096      }
41097      if (element.hasParam()) {
41098        openArray("param");
41099        for (TestScript.RulesetRuleParamComponent e : element.getParam()) 
41100          composeTestScriptRulesetRuleParamComponent(null, e);
41101        closeArray();
41102      };
41103  }
41104
41105  protected void composeTestScriptRulesetRuleParamComponent(String name, TestScript.RulesetRuleParamComponent element) throws IOException {
41106    if (element != null) {
41107      open(name);
41108      composeTestScriptRulesetRuleParamComponentInner(element);
41109      close();
41110    }
41111  }
41112
41113  protected void composeTestScriptRulesetRuleParamComponentInner(TestScript.RulesetRuleParamComponent element) throws IOException {
41114      composeBackbone(element);
41115      if (element.hasNameElement()) {
41116        composeStringCore("name", element.getNameElement(), false);
41117        composeStringExtras("name", element.getNameElement(), false);
41118      }
41119      if (element.hasValueElement()) {
41120        composeStringCore("value", element.getValueElement(), false);
41121        composeStringExtras("value", element.getValueElement(), false);
41122      }
41123  }
41124
41125  protected void composeTestScriptTestScriptSetupComponent(String name, TestScript.TestScriptSetupComponent element) throws IOException {
41126    if (element != null) {
41127      open(name);
41128      composeTestScriptTestScriptSetupComponentInner(element);
41129      close();
41130    }
41131  }
41132
41133  protected void composeTestScriptTestScriptSetupComponentInner(TestScript.TestScriptSetupComponent element) throws IOException {
41134      composeBackbone(element);
41135      if (element.hasAction()) {
41136        openArray("action");
41137        for (TestScript.SetupActionComponent e : element.getAction()) 
41138          composeTestScriptSetupActionComponent(null, e);
41139        closeArray();
41140      };
41141  }
41142
41143  protected void composeTestScriptSetupActionComponent(String name, TestScript.SetupActionComponent element) throws IOException {
41144    if (element != null) {
41145      open(name);
41146      composeTestScriptSetupActionComponentInner(element);
41147      close();
41148    }
41149  }
41150
41151  protected void composeTestScriptSetupActionComponentInner(TestScript.SetupActionComponent element) throws IOException {
41152      composeBackbone(element);
41153      if (element.hasOperation()) {
41154        composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
41155      }
41156      if (element.hasAssert()) {
41157        composeTestScriptSetupActionAssertComponent("assert", element.getAssert());
41158      }
41159  }
41160
41161  protected void composeTestScriptSetupActionOperationComponent(String name, TestScript.SetupActionOperationComponent element) throws IOException {
41162    if (element != null) {
41163      open(name);
41164      composeTestScriptSetupActionOperationComponentInner(element);
41165      close();
41166    }
41167  }
41168
41169  protected void composeTestScriptSetupActionOperationComponentInner(TestScript.SetupActionOperationComponent element) throws IOException {
41170      composeBackbone(element);
41171      if (element.hasType()) {
41172        composeCoding("type", element.getType());
41173      }
41174      if (element.hasResourceElement()) {
41175        composeCodeCore("resource", element.getResourceElement(), false);
41176        composeCodeExtras("resource", element.getResourceElement(), false);
41177      }
41178      if (element.hasLabelElement()) {
41179        composeStringCore("label", element.getLabelElement(), false);
41180        composeStringExtras("label", element.getLabelElement(), false);
41181      }
41182      if (element.hasDescriptionElement()) {
41183        composeStringCore("description", element.getDescriptionElement(), false);
41184        composeStringExtras("description", element.getDescriptionElement(), false);
41185      }
41186      if (element.hasAcceptElement()) {
41187        composeEnumerationCore("accept", element.getAcceptElement(), new TestScript.ContentTypeEnumFactory(), false);
41188        composeEnumerationExtras("accept", element.getAcceptElement(), new TestScript.ContentTypeEnumFactory(), false);
41189      }
41190      if (element.hasContentTypeElement()) {
41191        composeEnumerationCore("contentType", element.getContentTypeElement(), new TestScript.ContentTypeEnumFactory(), false);
41192        composeEnumerationExtras("contentType", element.getContentTypeElement(), new TestScript.ContentTypeEnumFactory(), false);
41193      }
41194      if (element.hasDestinationElement()) {
41195        composeIntegerCore("destination", element.getDestinationElement(), false);
41196        composeIntegerExtras("destination", element.getDestinationElement(), false);
41197      }
41198      if (element.hasEncodeRequestUrlElement()) {
41199        composeBooleanCore("encodeRequestUrl", element.getEncodeRequestUrlElement(), false);
41200        composeBooleanExtras("encodeRequestUrl", element.getEncodeRequestUrlElement(), false);
41201      }
41202      if (element.hasOriginElement()) {
41203        composeIntegerCore("origin", element.getOriginElement(), false);
41204        composeIntegerExtras("origin", element.getOriginElement(), false);
41205      }
41206      if (element.hasParamsElement()) {
41207        composeStringCore("params", element.getParamsElement(), false);
41208        composeStringExtras("params", element.getParamsElement(), false);
41209      }
41210      if (element.hasRequestHeader()) {
41211        openArray("requestHeader");
41212        for (TestScript.SetupActionOperationRequestHeaderComponent e : element.getRequestHeader()) 
41213          composeTestScriptSetupActionOperationRequestHeaderComponent(null, e);
41214        closeArray();
41215      };
41216      if (element.hasRequestIdElement()) {
41217        composeIdCore("requestId", element.getRequestIdElement(), false);
41218        composeIdExtras("requestId", element.getRequestIdElement(), false);
41219      }
41220      if (element.hasResponseIdElement()) {
41221        composeIdCore("responseId", element.getResponseIdElement(), false);
41222        composeIdExtras("responseId", element.getResponseIdElement(), false);
41223      }
41224      if (element.hasSourceIdElement()) {
41225        composeIdCore("sourceId", element.getSourceIdElement(), false);
41226        composeIdExtras("sourceId", element.getSourceIdElement(), false);
41227      }
41228      if (element.hasTargetIdElement()) {
41229        composeIdCore("targetId", element.getTargetIdElement(), false);
41230        composeIdExtras("targetId", element.getTargetIdElement(), false);
41231      }
41232      if (element.hasUrlElement()) {
41233        composeStringCore("url", element.getUrlElement(), false);
41234        composeStringExtras("url", element.getUrlElement(), false);
41235      }
41236  }
41237
41238  protected void composeTestScriptSetupActionOperationRequestHeaderComponent(String name, TestScript.SetupActionOperationRequestHeaderComponent element) throws IOException {
41239    if (element != null) {
41240      open(name);
41241      composeTestScriptSetupActionOperationRequestHeaderComponentInner(element);
41242      close();
41243    }
41244  }
41245
41246  protected void composeTestScriptSetupActionOperationRequestHeaderComponentInner(TestScript.SetupActionOperationRequestHeaderComponent element) throws IOException {
41247      composeBackbone(element);
41248      if (element.hasFieldElement()) {
41249        composeStringCore("field", element.getFieldElement(), false);
41250        composeStringExtras("field", element.getFieldElement(), false);
41251      }
41252      if (element.hasValueElement()) {
41253        composeStringCore("value", element.getValueElement(), false);
41254        composeStringExtras("value", element.getValueElement(), false);
41255      }
41256  }
41257
41258  protected void composeTestScriptSetupActionAssertComponent(String name, TestScript.SetupActionAssertComponent element) throws IOException {
41259    if (element != null) {
41260      open(name);
41261      composeTestScriptSetupActionAssertComponentInner(element);
41262      close();
41263    }
41264  }
41265
41266  protected void composeTestScriptSetupActionAssertComponentInner(TestScript.SetupActionAssertComponent element) throws IOException {
41267      composeBackbone(element);
41268      if (element.hasLabelElement()) {
41269        composeStringCore("label", element.getLabelElement(), false);
41270        composeStringExtras("label", element.getLabelElement(), false);
41271      }
41272      if (element.hasDescriptionElement()) {
41273        composeStringCore("description", element.getDescriptionElement(), false);
41274        composeStringExtras("description", element.getDescriptionElement(), false);
41275      }
41276      if (element.hasDirectionElement()) {
41277        composeEnumerationCore("direction", element.getDirectionElement(), new TestScript.AssertionDirectionTypeEnumFactory(), false);
41278        composeEnumerationExtras("direction", element.getDirectionElement(), new TestScript.AssertionDirectionTypeEnumFactory(), false);
41279      }
41280      if (element.hasCompareToSourceIdElement()) {
41281        composeStringCore("compareToSourceId", element.getCompareToSourceIdElement(), false);
41282        composeStringExtras("compareToSourceId", element.getCompareToSourceIdElement(), false);
41283      }
41284      if (element.hasCompareToSourceExpressionElement()) {
41285        composeStringCore("compareToSourceExpression", element.getCompareToSourceExpressionElement(), false);
41286        composeStringExtras("compareToSourceExpression", element.getCompareToSourceExpressionElement(), false);
41287      }
41288      if (element.hasCompareToSourcePathElement()) {
41289        composeStringCore("compareToSourcePath", element.getCompareToSourcePathElement(), false);
41290        composeStringExtras("compareToSourcePath", element.getCompareToSourcePathElement(), false);
41291      }
41292      if (element.hasContentTypeElement()) {
41293        composeEnumerationCore("contentType", element.getContentTypeElement(), new TestScript.ContentTypeEnumFactory(), false);
41294        composeEnumerationExtras("contentType", element.getContentTypeElement(), new TestScript.ContentTypeEnumFactory(), false);
41295      }
41296      if (element.hasExpressionElement()) {
41297        composeStringCore("expression", element.getExpressionElement(), false);
41298        composeStringExtras("expression", element.getExpressionElement(), false);
41299      }
41300      if (element.hasHeaderFieldElement()) {
41301        composeStringCore("headerField", element.getHeaderFieldElement(), false);
41302        composeStringExtras("headerField", element.getHeaderFieldElement(), false);
41303      }
41304      if (element.hasMinimumIdElement()) {
41305        composeStringCore("minimumId", element.getMinimumIdElement(), false);
41306        composeStringExtras("minimumId", element.getMinimumIdElement(), false);
41307      }
41308      if (element.hasNavigationLinksElement()) {
41309        composeBooleanCore("navigationLinks", element.getNavigationLinksElement(), false);
41310        composeBooleanExtras("navigationLinks", element.getNavigationLinksElement(), false);
41311      }
41312      if (element.hasOperatorElement()) {
41313        composeEnumerationCore("operator", element.getOperatorElement(), new TestScript.AssertionOperatorTypeEnumFactory(), false);
41314        composeEnumerationExtras("operator", element.getOperatorElement(), new TestScript.AssertionOperatorTypeEnumFactory(), false);
41315      }
41316      if (element.hasPathElement()) {
41317        composeStringCore("path", element.getPathElement(), false);
41318        composeStringExtras("path", element.getPathElement(), false);
41319      }
41320      if (element.hasRequestMethodElement()) {
41321        composeEnumerationCore("requestMethod", element.getRequestMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
41322        composeEnumerationExtras("requestMethod", element.getRequestMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
41323      }
41324      if (element.hasRequestURLElement()) {
41325        composeStringCore("requestURL", element.getRequestURLElement(), false);
41326        composeStringExtras("requestURL", element.getRequestURLElement(), false);
41327      }
41328      if (element.hasResourceElement()) {
41329        composeCodeCore("resource", element.getResourceElement(), false);
41330        composeCodeExtras("resource", element.getResourceElement(), false);
41331      }
41332      if (element.hasResponseElement()) {
41333        composeEnumerationCore("response", element.getResponseElement(), new TestScript.AssertionResponseTypesEnumFactory(), false);
41334        composeEnumerationExtras("response", element.getResponseElement(), new TestScript.AssertionResponseTypesEnumFactory(), false);
41335      }
41336      if (element.hasResponseCodeElement()) {
41337        composeStringCore("responseCode", element.getResponseCodeElement(), false);
41338        composeStringExtras("responseCode", element.getResponseCodeElement(), false);
41339      }
41340      if (element.hasRule()) {
41341        composeTestScriptActionAssertRuleComponent("rule", element.getRule());
41342      }
41343      if (element.hasRuleset()) {
41344        composeTestScriptActionAssertRulesetComponent("ruleset", element.getRuleset());
41345      }
41346      if (element.hasSourceIdElement()) {
41347        composeIdCore("sourceId", element.getSourceIdElement(), false);
41348        composeIdExtras("sourceId", element.getSourceIdElement(), false);
41349      }
41350      if (element.hasValidateProfileIdElement()) {
41351        composeIdCore("validateProfileId", element.getValidateProfileIdElement(), false);
41352        composeIdExtras("validateProfileId", element.getValidateProfileIdElement(), false);
41353      }
41354      if (element.hasValueElement()) {
41355        composeStringCore("value", element.getValueElement(), false);
41356        composeStringExtras("value", element.getValueElement(), false);
41357      }
41358      if (element.hasWarningOnlyElement()) {
41359        composeBooleanCore("warningOnly", element.getWarningOnlyElement(), false);
41360        composeBooleanExtras("warningOnly", element.getWarningOnlyElement(), false);
41361      }
41362  }
41363
41364  protected void composeTestScriptActionAssertRuleComponent(String name, TestScript.ActionAssertRuleComponent element) throws IOException {
41365    if (element != null) {
41366      open(name);
41367      composeTestScriptActionAssertRuleComponentInner(element);
41368      close();
41369    }
41370  }
41371
41372  protected void composeTestScriptActionAssertRuleComponentInner(TestScript.ActionAssertRuleComponent element) throws IOException {
41373      composeBackbone(element);
41374      if (element.hasRuleIdElement()) {
41375        composeIdCore("ruleId", element.getRuleIdElement(), false);
41376        composeIdExtras("ruleId", element.getRuleIdElement(), false);
41377      }
41378      if (element.hasParam()) {
41379        openArray("param");
41380        for (TestScript.ActionAssertRuleParamComponent e : element.getParam()) 
41381          composeTestScriptActionAssertRuleParamComponent(null, e);
41382        closeArray();
41383      };
41384  }
41385
41386  protected void composeTestScriptActionAssertRuleParamComponent(String name, TestScript.ActionAssertRuleParamComponent element) throws IOException {
41387    if (element != null) {
41388      open(name);
41389      composeTestScriptActionAssertRuleParamComponentInner(element);
41390      close();
41391    }
41392  }
41393
41394  protected void composeTestScriptActionAssertRuleParamComponentInner(TestScript.ActionAssertRuleParamComponent element) throws IOException {
41395      composeBackbone(element);
41396      if (element.hasNameElement()) {
41397        composeStringCore("name", element.getNameElement(), false);
41398        composeStringExtras("name", element.getNameElement(), false);
41399      }
41400      if (element.hasValueElement()) {
41401        composeStringCore("value", element.getValueElement(), false);
41402        composeStringExtras("value", element.getValueElement(), false);
41403      }
41404  }
41405
41406  protected void composeTestScriptActionAssertRulesetComponent(String name, TestScript.ActionAssertRulesetComponent element) throws IOException {
41407    if (element != null) {
41408      open(name);
41409      composeTestScriptActionAssertRulesetComponentInner(element);
41410      close();
41411    }
41412  }
41413
41414  protected void composeTestScriptActionAssertRulesetComponentInner(TestScript.ActionAssertRulesetComponent element) throws IOException {
41415      composeBackbone(element);
41416      if (element.hasRulesetIdElement()) {
41417        composeIdCore("rulesetId", element.getRulesetIdElement(), false);
41418        composeIdExtras("rulesetId", element.getRulesetIdElement(), false);
41419      }
41420      if (element.hasRule()) {
41421        openArray("rule");
41422        for (TestScript.ActionAssertRulesetRuleComponent e : element.getRule()) 
41423          composeTestScriptActionAssertRulesetRuleComponent(null, e);
41424        closeArray();
41425      };
41426  }
41427
41428  protected void composeTestScriptActionAssertRulesetRuleComponent(String name, TestScript.ActionAssertRulesetRuleComponent element) throws IOException {
41429    if (element != null) {
41430      open(name);
41431      composeTestScriptActionAssertRulesetRuleComponentInner(element);
41432      close();
41433    }
41434  }
41435
41436  protected void composeTestScriptActionAssertRulesetRuleComponentInner(TestScript.ActionAssertRulesetRuleComponent element) throws IOException {
41437      composeBackbone(element);
41438      if (element.hasRuleIdElement()) {
41439        composeIdCore("ruleId", element.getRuleIdElement(), false);
41440        composeIdExtras("ruleId", element.getRuleIdElement(), false);
41441      }
41442      if (element.hasParam()) {
41443        openArray("param");
41444        for (TestScript.ActionAssertRulesetRuleParamComponent e : element.getParam()) 
41445          composeTestScriptActionAssertRulesetRuleParamComponent(null, e);
41446        closeArray();
41447      };
41448  }
41449
41450  protected void composeTestScriptActionAssertRulesetRuleParamComponent(String name, TestScript.ActionAssertRulesetRuleParamComponent element) throws IOException {
41451    if (element != null) {
41452      open(name);
41453      composeTestScriptActionAssertRulesetRuleParamComponentInner(element);
41454      close();
41455    }
41456  }
41457
41458  protected void composeTestScriptActionAssertRulesetRuleParamComponentInner(TestScript.ActionAssertRulesetRuleParamComponent element) throws IOException {
41459      composeBackbone(element);
41460      if (element.hasNameElement()) {
41461        composeStringCore("name", element.getNameElement(), false);
41462        composeStringExtras("name", element.getNameElement(), false);
41463      }
41464      if (element.hasValueElement()) {
41465        composeStringCore("value", element.getValueElement(), false);
41466        composeStringExtras("value", element.getValueElement(), false);
41467      }
41468  }
41469
41470  protected void composeTestScriptTestScriptTestComponent(String name, TestScript.TestScriptTestComponent element) throws IOException {
41471    if (element != null) {
41472      open(name);
41473      composeTestScriptTestScriptTestComponentInner(element);
41474      close();
41475    }
41476  }
41477
41478  protected void composeTestScriptTestScriptTestComponentInner(TestScript.TestScriptTestComponent element) throws IOException {
41479      composeBackbone(element);
41480      if (element.hasNameElement()) {
41481        composeStringCore("name", element.getNameElement(), false);
41482        composeStringExtras("name", element.getNameElement(), false);
41483      }
41484      if (element.hasDescriptionElement()) {
41485        composeStringCore("description", element.getDescriptionElement(), false);
41486        composeStringExtras("description", element.getDescriptionElement(), false);
41487      }
41488      if (element.hasAction()) {
41489        openArray("action");
41490        for (TestScript.TestActionComponent e : element.getAction()) 
41491          composeTestScriptTestActionComponent(null, e);
41492        closeArray();
41493      };
41494  }
41495
41496  protected void composeTestScriptTestActionComponent(String name, TestScript.TestActionComponent element) throws IOException {
41497    if (element != null) {
41498      open(name);
41499      composeTestScriptTestActionComponentInner(element);
41500      close();
41501    }
41502  }
41503
41504  protected void composeTestScriptTestActionComponentInner(TestScript.TestActionComponent element) throws IOException {
41505      composeBackbone(element);
41506      if (element.hasOperation()) {
41507        composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
41508      }
41509      if (element.hasAssert()) {
41510        composeTestScriptSetupActionAssertComponent("assert", element.getAssert());
41511      }
41512  }
41513
41514  protected void composeTestScriptTestScriptTeardownComponent(String name, TestScript.TestScriptTeardownComponent element) throws IOException {
41515    if (element != null) {
41516      open(name);
41517      composeTestScriptTestScriptTeardownComponentInner(element);
41518      close();
41519    }
41520  }
41521
41522  protected void composeTestScriptTestScriptTeardownComponentInner(TestScript.TestScriptTeardownComponent element) throws IOException {
41523      composeBackbone(element);
41524      if (element.hasAction()) {
41525        openArray("action");
41526        for (TestScript.TeardownActionComponent e : element.getAction()) 
41527          composeTestScriptTeardownActionComponent(null, e);
41528        closeArray();
41529      };
41530  }
41531
41532  protected void composeTestScriptTeardownActionComponent(String name, TestScript.TeardownActionComponent element) throws IOException {
41533    if (element != null) {
41534      open(name);
41535      composeTestScriptTeardownActionComponentInner(element);
41536      close();
41537    }
41538  }
41539
41540  protected void composeTestScriptTeardownActionComponentInner(TestScript.TeardownActionComponent element) throws IOException {
41541      composeBackbone(element);
41542      if (element.hasOperation()) {
41543        composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
41544      }
41545  }
41546
41547  protected void composeValueSet(String name, ValueSet element) throws IOException {
41548    if (element != null) {
41549      prop("resourceType", name);
41550      composeValueSetInner(element);
41551    }
41552  }
41553
41554  protected void composeValueSetInner(ValueSet element) throws IOException {
41555      composeDomainResourceElements(element);
41556      if (element.hasUrlElement()) {
41557        composeUriCore("url", element.getUrlElement(), false);
41558        composeUriExtras("url", element.getUrlElement(), false);
41559      }
41560      if (element.hasIdentifier()) {
41561        openArray("identifier");
41562        for (Identifier e : element.getIdentifier()) 
41563          composeIdentifier(null, e);
41564        closeArray();
41565      };
41566      if (element.hasVersionElement()) {
41567        composeStringCore("version", element.getVersionElement(), false);
41568        composeStringExtras("version", element.getVersionElement(), false);
41569      }
41570      if (element.hasNameElement()) {
41571        composeStringCore("name", element.getNameElement(), false);
41572        composeStringExtras("name", element.getNameElement(), false);
41573      }
41574      if (element.hasTitleElement()) {
41575        composeStringCore("title", element.getTitleElement(), false);
41576        composeStringExtras("title", element.getTitleElement(), false);
41577      }
41578      if (element.hasStatusElement()) {
41579        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
41580        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
41581      }
41582      if (element.hasExperimentalElement()) {
41583        composeBooleanCore("experimental", element.getExperimentalElement(), false);
41584        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
41585      }
41586      if (element.hasDateElement()) {
41587        composeDateTimeCore("date", element.getDateElement(), false);
41588        composeDateTimeExtras("date", element.getDateElement(), false);
41589      }
41590      if (element.hasPublisherElement()) {
41591        composeStringCore("publisher", element.getPublisherElement(), false);
41592        composeStringExtras("publisher", element.getPublisherElement(), false);
41593      }
41594      if (element.hasContact()) {
41595        openArray("contact");
41596        for (ContactDetail e : element.getContact()) 
41597          composeContactDetail(null, e);
41598        closeArray();
41599      };
41600      if (element.hasDescriptionElement()) {
41601        composeMarkdownCore("description", element.getDescriptionElement(), false);
41602        composeMarkdownExtras("description", element.getDescriptionElement(), false);
41603      }
41604      if (element.hasUseContext()) {
41605        openArray("useContext");
41606        for (UsageContext e : element.getUseContext()) 
41607          composeUsageContext(null, e);
41608        closeArray();
41609      };
41610      if (element.hasJurisdiction()) {
41611        openArray("jurisdiction");
41612        for (CodeableConcept e : element.getJurisdiction()) 
41613          composeCodeableConcept(null, e);
41614        closeArray();
41615      };
41616      if (element.hasImmutableElement()) {
41617        composeBooleanCore("immutable", element.getImmutableElement(), false);
41618        composeBooleanExtras("immutable", element.getImmutableElement(), false);
41619      }
41620      if (element.hasPurposeElement()) {
41621        composeMarkdownCore("purpose", element.getPurposeElement(), false);
41622        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
41623      }
41624      if (element.hasCopyrightElement()) {
41625        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
41626        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
41627      }
41628      if (element.hasExtensibleElement()) {
41629        composeBooleanCore("extensible", element.getExtensibleElement(), false);
41630        composeBooleanExtras("extensible", element.getExtensibleElement(), false);
41631      }
41632      if (element.hasCompose()) {
41633        composeValueSetValueSetComposeComponent("compose", element.getCompose());
41634      }
41635      if (element.hasExpansion()) {
41636        composeValueSetValueSetExpansionComponent("expansion", element.getExpansion());
41637      }
41638  }
41639
41640  protected void composeValueSetValueSetComposeComponent(String name, ValueSet.ValueSetComposeComponent element) throws IOException {
41641    if (element != null) {
41642      open(name);
41643      composeValueSetValueSetComposeComponentInner(element);
41644      close();
41645    }
41646  }
41647
41648  protected void composeValueSetValueSetComposeComponentInner(ValueSet.ValueSetComposeComponent element) throws IOException {
41649      composeBackbone(element);
41650      if (element.hasLockedDateElement()) {
41651        composeDateCore("lockedDate", element.getLockedDateElement(), false);
41652        composeDateExtras("lockedDate", element.getLockedDateElement(), false);
41653      }
41654      if (element.hasInactiveElement()) {
41655        composeBooleanCore("inactive", element.getInactiveElement(), false);
41656        composeBooleanExtras("inactive", element.getInactiveElement(), false);
41657      }
41658      if (element.hasInclude()) {
41659        openArray("include");
41660        for (ValueSet.ConceptSetComponent e : element.getInclude()) 
41661          composeValueSetConceptSetComponent(null, e);
41662        closeArray();
41663      };
41664      if (element.hasExclude()) {
41665        openArray("exclude");
41666        for (ValueSet.ConceptSetComponent e : element.getExclude()) 
41667          composeValueSetConceptSetComponent(null, e);
41668        closeArray();
41669      };
41670  }
41671
41672  protected void composeValueSetConceptSetComponent(String name, ValueSet.ConceptSetComponent element) throws IOException {
41673    if (element != null) {
41674      open(name);
41675      composeValueSetConceptSetComponentInner(element);
41676      close();
41677    }
41678  }
41679
41680  protected void composeValueSetConceptSetComponentInner(ValueSet.ConceptSetComponent element) throws IOException {
41681      composeBackbone(element);
41682      if (element.hasSystemElement()) {
41683        composeUriCore("system", element.getSystemElement(), false);
41684        composeUriExtras("system", element.getSystemElement(), false);
41685      }
41686      if (element.hasVersionElement()) {
41687        composeStringCore("version", element.getVersionElement(), false);
41688        composeStringExtras("version", element.getVersionElement(), false);
41689      }
41690      if (element.hasConcept()) {
41691        openArray("concept");
41692        for (ValueSet.ConceptReferenceComponent e : element.getConcept()) 
41693          composeValueSetConceptReferenceComponent(null, e);
41694        closeArray();
41695      };
41696      if (element.hasFilter()) {
41697        openArray("filter");
41698        for (ValueSet.ConceptSetFilterComponent e : element.getFilter()) 
41699          composeValueSetConceptSetFilterComponent(null, e);
41700        closeArray();
41701      };
41702      if (element.hasValueSet()) {
41703        openArray("valueSet");
41704        for (UriType e : element.getValueSet()) 
41705          composeUriCore(null, e, true);
41706        closeArray();
41707        if (anyHasExtras(element.getValueSet())) {
41708          openArray("_valueSet");
41709          for (UriType e : element.getValueSet()) 
41710            composeUriExtras(null, e, true);
41711          closeArray();
41712        }
41713      };
41714  }
41715
41716  protected void composeValueSetConceptReferenceComponent(String name, ValueSet.ConceptReferenceComponent element) throws IOException {
41717    if (element != null) {
41718      open(name);
41719      composeValueSetConceptReferenceComponentInner(element);
41720      close();
41721    }
41722  }
41723
41724  protected void composeValueSetConceptReferenceComponentInner(ValueSet.ConceptReferenceComponent element) throws IOException {
41725      composeBackbone(element);
41726      if (element.hasCodeElement()) {
41727        composeCodeCore("code", element.getCodeElement(), false);
41728        composeCodeExtras("code", element.getCodeElement(), false);
41729      }
41730      if (element.hasDisplayElement()) {
41731        composeStringCore("display", element.getDisplayElement(), false);
41732        composeStringExtras("display", element.getDisplayElement(), false);
41733      }
41734      if (element.hasDesignation()) {
41735        openArray("designation");
41736        for (ValueSet.ConceptReferenceDesignationComponent e : element.getDesignation()) 
41737          composeValueSetConceptReferenceDesignationComponent(null, e);
41738        closeArray();
41739      };
41740  }
41741
41742  protected void composeValueSetConceptReferenceDesignationComponent(String name, ValueSet.ConceptReferenceDesignationComponent element) throws IOException {
41743    if (element != null) {
41744      open(name);
41745      composeValueSetConceptReferenceDesignationComponentInner(element);
41746      close();
41747    }
41748  }
41749
41750  protected void composeValueSetConceptReferenceDesignationComponentInner(ValueSet.ConceptReferenceDesignationComponent element) throws IOException {
41751      composeBackbone(element);
41752      if (element.hasLanguageElement()) {
41753        composeCodeCore("language", element.getLanguageElement(), false);
41754        composeCodeExtras("language", element.getLanguageElement(), false);
41755      }
41756      if (element.hasUse()) {
41757        composeCoding("use", element.getUse());
41758      }
41759      if (element.hasValueElement()) {
41760        composeStringCore("value", element.getValueElement(), false);
41761        composeStringExtras("value", element.getValueElement(), false);
41762      }
41763  }
41764
41765  protected void composeValueSetConceptSetFilterComponent(String name, ValueSet.ConceptSetFilterComponent element) throws IOException {
41766    if (element != null) {
41767      open(name);
41768      composeValueSetConceptSetFilterComponentInner(element);
41769      close();
41770    }
41771  }
41772
41773  protected void composeValueSetConceptSetFilterComponentInner(ValueSet.ConceptSetFilterComponent element) throws IOException {
41774      composeBackbone(element);
41775      if (element.hasPropertyElement()) {
41776        composeCodeCore("property", element.getPropertyElement(), false);
41777        composeCodeExtras("property", element.getPropertyElement(), false);
41778      }
41779      if (element.hasOpElement()) {
41780        composeEnumerationCore("op", element.getOpElement(), new ValueSet.FilterOperatorEnumFactory(), false);
41781        composeEnumerationExtras("op", element.getOpElement(), new ValueSet.FilterOperatorEnumFactory(), false);
41782      }
41783      if (element.hasValueElement()) {
41784        composeCodeCore("value", element.getValueElement(), false);
41785        composeCodeExtras("value", element.getValueElement(), false);
41786      }
41787  }
41788
41789  protected void composeValueSetValueSetExpansionComponent(String name, ValueSet.ValueSetExpansionComponent element) throws IOException {
41790    if (element != null) {
41791      open(name);
41792      composeValueSetValueSetExpansionComponentInner(element);
41793      close();
41794    }
41795  }
41796
41797  protected void composeValueSetValueSetExpansionComponentInner(ValueSet.ValueSetExpansionComponent element) throws IOException {
41798      composeBackbone(element);
41799      if (element.hasIdentifierElement()) {
41800        composeUriCore("identifier", element.getIdentifierElement(), false);
41801        composeUriExtras("identifier", element.getIdentifierElement(), false);
41802      }
41803      if (element.hasTimestampElement()) {
41804        composeDateTimeCore("timestamp", element.getTimestampElement(), false);
41805        composeDateTimeExtras("timestamp", element.getTimestampElement(), false);
41806      }
41807      if (element.hasTotalElement()) {
41808        composeIntegerCore("total", element.getTotalElement(), false);
41809        composeIntegerExtras("total", element.getTotalElement(), false);
41810      }
41811      if (element.hasOffsetElement()) {
41812        composeIntegerCore("offset", element.getOffsetElement(), false);
41813        composeIntegerExtras("offset", element.getOffsetElement(), false);
41814      }
41815      if (element.hasParameter()) {
41816        openArray("parameter");
41817        for (ValueSet.ValueSetExpansionParameterComponent e : element.getParameter()) 
41818          composeValueSetValueSetExpansionParameterComponent(null, e);
41819        closeArray();
41820      };
41821      if (element.hasContains()) {
41822        openArray("contains");
41823        for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
41824          composeValueSetValueSetExpansionContainsComponent(null, e);
41825        closeArray();
41826      };
41827  }
41828
41829  protected void composeValueSetValueSetExpansionParameterComponent(String name, ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
41830    if (element != null) {
41831      open(name);
41832      composeValueSetValueSetExpansionParameterComponentInner(element);
41833      close();
41834    }
41835  }
41836
41837  protected void composeValueSetValueSetExpansionParameterComponentInner(ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
41838      composeBackbone(element);
41839      if (element.hasNameElement()) {
41840        composeStringCore("name", element.getNameElement(), false);
41841        composeStringExtras("name", element.getNameElement(), false);
41842      }
41843      if (element.hasValue()) {
41844        composeType("value", element.getValue());
41845      }
41846  }
41847
41848  protected void composeValueSetValueSetExpansionContainsComponent(String name, ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
41849    if (element != null) {
41850      open(name);
41851      composeValueSetValueSetExpansionContainsComponentInner(element);
41852      close();
41853    }
41854  }
41855
41856  protected void composeValueSetValueSetExpansionContainsComponentInner(ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
41857      composeBackbone(element);
41858      if (element.hasSystemElement()) {
41859        composeUriCore("system", element.getSystemElement(), false);
41860        composeUriExtras("system", element.getSystemElement(), false);
41861      }
41862      if (element.hasAbstractElement()) {
41863        composeBooleanCore("abstract", element.getAbstractElement(), false);
41864        composeBooleanExtras("abstract", element.getAbstractElement(), false);
41865      }
41866      if (element.hasInactiveElement()) {
41867        composeBooleanCore("inactive", element.getInactiveElement(), false);
41868        composeBooleanExtras("inactive", element.getInactiveElement(), false);
41869      }
41870      if (element.hasVersionElement()) {
41871        composeStringCore("version", element.getVersionElement(), false);
41872        composeStringExtras("version", element.getVersionElement(), false);
41873      }
41874      if (element.hasCodeElement()) {
41875        composeCodeCore("code", element.getCodeElement(), false);
41876        composeCodeExtras("code", element.getCodeElement(), false);
41877      }
41878      if (element.hasDisplayElement()) {
41879        composeStringCore("display", element.getDisplayElement(), false);
41880        composeStringExtras("display", element.getDisplayElement(), false);
41881      }
41882      if (element.hasDesignation()) {
41883        openArray("designation");
41884        for (ValueSet.ConceptReferenceDesignationComponent e : element.getDesignation()) 
41885          composeValueSetConceptReferenceDesignationComponent(null, e);
41886        closeArray();
41887      };
41888      if (element.hasContains()) {
41889        openArray("contains");
41890        for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
41891          composeValueSetValueSetExpansionContainsComponent(null, e);
41892        closeArray();
41893      };
41894  }
41895
41896  protected void composeVisionPrescription(String name, VisionPrescription element) throws IOException {
41897    if (element != null) {
41898      prop("resourceType", name);
41899      composeVisionPrescriptionInner(element);
41900    }
41901  }
41902
41903  protected void composeVisionPrescriptionInner(VisionPrescription element) throws IOException {
41904      composeDomainResourceElements(element);
41905      if (element.hasIdentifier()) {
41906        openArray("identifier");
41907        for (Identifier e : element.getIdentifier()) 
41908          composeIdentifier(null, e);
41909        closeArray();
41910      };
41911      if (element.hasStatusElement()) {
41912        composeEnumerationCore("status", element.getStatusElement(), new VisionPrescription.VisionStatusEnumFactory(), false);
41913        composeEnumerationExtras("status", element.getStatusElement(), new VisionPrescription.VisionStatusEnumFactory(), false);
41914      }
41915      if (element.hasPatient()) {
41916        composeReference("patient", element.getPatient());
41917      }
41918      if (element.hasEncounter()) {
41919        composeReference("encounter", element.getEncounter());
41920      }
41921      if (element.hasDateWrittenElement()) {
41922        composeDateTimeCore("dateWritten", element.getDateWrittenElement(), false);
41923        composeDateTimeExtras("dateWritten", element.getDateWrittenElement(), false);
41924      }
41925      if (element.hasPrescriber()) {
41926        composeReference("prescriber", element.getPrescriber());
41927      }
41928      if (element.hasReason()) {
41929        composeType("reason", element.getReason());
41930      }
41931      if (element.hasDispense()) {
41932        openArray("dispense");
41933        for (VisionPrescription.VisionPrescriptionDispenseComponent e : element.getDispense()) 
41934          composeVisionPrescriptionVisionPrescriptionDispenseComponent(null, e);
41935        closeArray();
41936      };
41937  }
41938
41939  protected void composeVisionPrescriptionVisionPrescriptionDispenseComponent(String name, VisionPrescription.VisionPrescriptionDispenseComponent element) throws IOException {
41940    if (element != null) {
41941      open(name);
41942      composeVisionPrescriptionVisionPrescriptionDispenseComponentInner(element);
41943      close();
41944    }
41945  }
41946
41947  protected void composeVisionPrescriptionVisionPrescriptionDispenseComponentInner(VisionPrescription.VisionPrescriptionDispenseComponent element) throws IOException {
41948      composeBackbone(element);
41949      if (element.hasProduct()) {
41950        composeCodeableConcept("product", element.getProduct());
41951      }
41952      if (element.hasEyeElement()) {
41953        composeEnumerationCore("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory(), false);
41954        composeEnumerationExtras("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory(), false);
41955      }
41956      if (element.hasSphereElement()) {
41957        composeDecimalCore("sphere", element.getSphereElement(), false);
41958        composeDecimalExtras("sphere", element.getSphereElement(), false);
41959      }
41960      if (element.hasCylinderElement()) {
41961        composeDecimalCore("cylinder", element.getCylinderElement(), false);
41962        composeDecimalExtras("cylinder", element.getCylinderElement(), false);
41963      }
41964      if (element.hasAxisElement()) {
41965        composeIntegerCore("axis", element.getAxisElement(), false);
41966        composeIntegerExtras("axis", element.getAxisElement(), false);
41967      }
41968      if (element.hasPrismElement()) {
41969        composeDecimalCore("prism", element.getPrismElement(), false);
41970        composeDecimalExtras("prism", element.getPrismElement(), false);
41971      }
41972      if (element.hasBaseElement()) {
41973        composeEnumerationCore("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory(), false);
41974        composeEnumerationExtras("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory(), false);
41975      }
41976      if (element.hasAddElement()) {
41977        composeDecimalCore("add", element.getAddElement(), false);
41978        composeDecimalExtras("add", element.getAddElement(), false);
41979      }
41980      if (element.hasPowerElement()) {
41981        composeDecimalCore("power", element.getPowerElement(), false);
41982        composeDecimalExtras("power", element.getPowerElement(), false);
41983      }
41984      if (element.hasBackCurveElement()) {
41985        composeDecimalCore("backCurve", element.getBackCurveElement(), false);
41986        composeDecimalExtras("backCurve", element.getBackCurveElement(), false);
41987      }
41988      if (element.hasDiameterElement()) {
41989        composeDecimalCore("diameter", element.getDiameterElement(), false);
41990        composeDecimalExtras("diameter", element.getDiameterElement(), false);
41991      }
41992      if (element.hasDuration()) {
41993        composeSimpleQuantity("duration", element.getDuration());
41994      }
41995      if (element.hasColorElement()) {
41996        composeStringCore("color", element.getColorElement(), false);
41997        composeStringExtras("color", element.getColorElement(), false);
41998      }
41999      if (element.hasBrandElement()) {
42000        composeStringCore("brand", element.getBrandElement(), false);
42001        composeStringExtras("brand", element.getBrandElement(), false);
42002      }
42003      if (element.hasNote()) {
42004        openArray("note");
42005        for (Annotation e : element.getNote()) 
42006          composeAnnotation(null, e);
42007        closeArray();
42008      };
42009  }
42010
42011  @Override
42012  protected void composeResource(Resource resource) throws IOException {
42013    if (resource instanceof Parameters)
42014      composeParameters("Parameters", (Parameters)resource);
42015    else if (resource instanceof Account)
42016      composeAccount("Account", (Account)resource);
42017    else if (resource instanceof ActivityDefinition)
42018      composeActivityDefinition("ActivityDefinition", (ActivityDefinition)resource);
42019    else if (resource instanceof AdverseEvent)
42020      composeAdverseEvent("AdverseEvent", (AdverseEvent)resource);
42021    else if (resource instanceof AllergyIntolerance)
42022      composeAllergyIntolerance("AllergyIntolerance", (AllergyIntolerance)resource);
42023    else if (resource instanceof Appointment)
42024      composeAppointment("Appointment", (Appointment)resource);
42025    else if (resource instanceof AppointmentResponse)
42026      composeAppointmentResponse("AppointmentResponse", (AppointmentResponse)resource);
42027    else if (resource instanceof AuditEvent)
42028      composeAuditEvent("AuditEvent", (AuditEvent)resource);
42029    else if (resource instanceof Basic)
42030      composeBasic("Basic", (Basic)resource);
42031    else if (resource instanceof Binary)
42032      composeBinary("Binary", (Binary)resource);
42033    else if (resource instanceof BodySite)
42034      composeBodySite("BodySite", (BodySite)resource);
42035    else if (resource instanceof Bundle)
42036      composeBundle("Bundle", (Bundle)resource);
42037    else if (resource instanceof CapabilityStatement)
42038      composeCapabilityStatement("CapabilityStatement", (CapabilityStatement)resource);
42039    else if (resource instanceof CarePlan)
42040      composeCarePlan("CarePlan", (CarePlan)resource);
42041    else if (resource instanceof CareTeam)
42042      composeCareTeam("CareTeam", (CareTeam)resource);
42043    else if (resource instanceof ChargeItem)
42044      composeChargeItem("ChargeItem", (ChargeItem)resource);
42045    else if (resource instanceof Claim)
42046      composeClaim("Claim", (Claim)resource);
42047    else if (resource instanceof ClaimResponse)
42048      composeClaimResponse("ClaimResponse", (ClaimResponse)resource);
42049    else if (resource instanceof ClinicalImpression)
42050      composeClinicalImpression("ClinicalImpression", (ClinicalImpression)resource);
42051    else if (resource instanceof CodeSystem)
42052      composeCodeSystem("CodeSystem", (CodeSystem)resource);
42053    else if (resource instanceof Communication)
42054      composeCommunication("Communication", (Communication)resource);
42055    else if (resource instanceof CommunicationRequest)
42056      composeCommunicationRequest("CommunicationRequest", (CommunicationRequest)resource);
42057    else if (resource instanceof CompartmentDefinition)
42058      composeCompartmentDefinition("CompartmentDefinition", (CompartmentDefinition)resource);
42059    else if (resource instanceof Composition)
42060      composeComposition("Composition", (Composition)resource);
42061    else if (resource instanceof ConceptMap)
42062      composeConceptMap("ConceptMap", (ConceptMap)resource);
42063    else if (resource instanceof Condition)
42064      composeCondition("Condition", (Condition)resource);
42065    else if (resource instanceof Consent)
42066      composeConsent("Consent", (Consent)resource);
42067    else if (resource instanceof Contract)
42068      composeContract("Contract", (Contract)resource);
42069    else if (resource instanceof Coverage)
42070      composeCoverage("Coverage", (Coverage)resource);
42071    else if (resource instanceof DataElement)
42072      composeDataElement("DataElement", (DataElement)resource);
42073    else if (resource instanceof DetectedIssue)
42074      composeDetectedIssue("DetectedIssue", (DetectedIssue)resource);
42075    else if (resource instanceof Device)
42076      composeDevice("Device", (Device)resource);
42077    else if (resource instanceof DeviceComponent)
42078      composeDeviceComponent("DeviceComponent", (DeviceComponent)resource);
42079    else if (resource instanceof DeviceMetric)
42080      composeDeviceMetric("DeviceMetric", (DeviceMetric)resource);
42081    else if (resource instanceof DeviceRequest)
42082      composeDeviceRequest("DeviceRequest", (DeviceRequest)resource);
42083    else if (resource instanceof DeviceUseStatement)
42084      composeDeviceUseStatement("DeviceUseStatement", (DeviceUseStatement)resource);
42085    else if (resource instanceof DiagnosticReport)
42086      composeDiagnosticReport("DiagnosticReport", (DiagnosticReport)resource);
42087    else if (resource instanceof DocumentManifest)
42088      composeDocumentManifest("DocumentManifest", (DocumentManifest)resource);
42089    else if (resource instanceof DocumentReference)
42090      composeDocumentReference("DocumentReference", (DocumentReference)resource);
42091    else if (resource instanceof EligibilityRequest)
42092      composeEligibilityRequest("EligibilityRequest", (EligibilityRequest)resource);
42093    else if (resource instanceof EligibilityResponse)
42094      composeEligibilityResponse("EligibilityResponse", (EligibilityResponse)resource);
42095    else if (resource instanceof Encounter)
42096      composeEncounter("Encounter", (Encounter)resource);
42097    else if (resource instanceof Endpoint)
42098      composeEndpoint("Endpoint", (Endpoint)resource);
42099    else if (resource instanceof EnrollmentRequest)
42100      composeEnrollmentRequest("EnrollmentRequest", (EnrollmentRequest)resource);
42101    else if (resource instanceof EnrollmentResponse)
42102      composeEnrollmentResponse("EnrollmentResponse", (EnrollmentResponse)resource);
42103    else if (resource instanceof EpisodeOfCare)
42104      composeEpisodeOfCare("EpisodeOfCare", (EpisodeOfCare)resource);
42105    else if (resource instanceof ExpansionProfile)
42106      composeExpansionProfile("ExpansionProfile", (ExpansionProfile)resource);
42107    else if (resource instanceof ExplanationOfBenefit)
42108      composeExplanationOfBenefit("ExplanationOfBenefit", (ExplanationOfBenefit)resource);
42109    else if (resource instanceof FamilyMemberHistory)
42110      composeFamilyMemberHistory("FamilyMemberHistory", (FamilyMemberHistory)resource);
42111    else if (resource instanceof Flag)
42112      composeFlag("Flag", (Flag)resource);
42113    else if (resource instanceof Goal)
42114      composeGoal("Goal", (Goal)resource);
42115    else if (resource instanceof GraphDefinition)
42116      composeGraphDefinition("GraphDefinition", (GraphDefinition)resource);
42117    else if (resource instanceof Group)
42118      composeGroup("Group", (Group)resource);
42119    else if (resource instanceof GuidanceResponse)
42120      composeGuidanceResponse("GuidanceResponse", (GuidanceResponse)resource);
42121    else if (resource instanceof HealthcareService)
42122      composeHealthcareService("HealthcareService", (HealthcareService)resource);
42123    else if (resource instanceof ImagingManifest)
42124      composeImagingManifest("ImagingManifest", (ImagingManifest)resource);
42125    else if (resource instanceof ImagingStudy)
42126      composeImagingStudy("ImagingStudy", (ImagingStudy)resource);
42127    else if (resource instanceof Immunization)
42128      composeImmunization("Immunization", (Immunization)resource);
42129    else if (resource instanceof ImmunizationRecommendation)
42130      composeImmunizationRecommendation("ImmunizationRecommendation", (ImmunizationRecommendation)resource);
42131    else if (resource instanceof ImplementationGuide)
42132      composeImplementationGuide("ImplementationGuide", (ImplementationGuide)resource);
42133    else if (resource instanceof Library)
42134      composeLibrary("Library", (Library)resource);
42135    else if (resource instanceof Linkage)
42136      composeLinkage("Linkage", (Linkage)resource);
42137    else if (resource instanceof ListResource)
42138      composeListResource("List", (ListResource)resource);
42139    else if (resource instanceof Location)
42140      composeLocation("Location", (Location)resource);
42141    else if (resource instanceof Measure)
42142      composeMeasure("Measure", (Measure)resource);
42143    else if (resource instanceof MeasureReport)
42144      composeMeasureReport("MeasureReport", (MeasureReport)resource);
42145    else if (resource instanceof Media)
42146      composeMedia("Media", (Media)resource);
42147    else if (resource instanceof Medication)
42148      composeMedication("Medication", (Medication)resource);
42149    else if (resource instanceof MedicationAdministration)
42150      composeMedicationAdministration("MedicationAdministration", (MedicationAdministration)resource);
42151    else if (resource instanceof MedicationDispense)
42152      composeMedicationDispense("MedicationDispense", (MedicationDispense)resource);
42153    else if (resource instanceof MedicationRequest)
42154      composeMedicationRequest("MedicationRequest", (MedicationRequest)resource);
42155    else if (resource instanceof MedicationStatement)
42156      composeMedicationStatement("MedicationStatement", (MedicationStatement)resource);
42157    else if (resource instanceof MessageDefinition)
42158      composeMessageDefinition("MessageDefinition", (MessageDefinition)resource);
42159    else if (resource instanceof MessageHeader)
42160      composeMessageHeader("MessageHeader", (MessageHeader)resource);
42161    else if (resource instanceof NamingSystem)
42162      composeNamingSystem("NamingSystem", (NamingSystem)resource);
42163    else if (resource instanceof NutritionOrder)
42164      composeNutritionOrder("NutritionOrder", (NutritionOrder)resource);
42165    else if (resource instanceof Observation)
42166      composeObservation("Observation", (Observation)resource);
42167    else if (resource instanceof OperationDefinition)
42168      composeOperationDefinition("OperationDefinition", (OperationDefinition)resource);
42169    else if (resource instanceof OperationOutcome)
42170      composeOperationOutcome("OperationOutcome", (OperationOutcome)resource);
42171    else if (resource instanceof Organization)
42172      composeOrganization("Organization", (Organization)resource);
42173    else if (resource instanceof Patient)
42174      composePatient("Patient", (Patient)resource);
42175    else if (resource instanceof PaymentNotice)
42176      composePaymentNotice("PaymentNotice", (PaymentNotice)resource);
42177    else if (resource instanceof PaymentReconciliation)
42178      composePaymentReconciliation("PaymentReconciliation", (PaymentReconciliation)resource);
42179    else if (resource instanceof Person)
42180      composePerson("Person", (Person)resource);
42181    else if (resource instanceof PlanDefinition)
42182      composePlanDefinition("PlanDefinition", (PlanDefinition)resource);
42183    else if (resource instanceof Practitioner)
42184      composePractitioner("Practitioner", (Practitioner)resource);
42185    else if (resource instanceof PractitionerRole)
42186      composePractitionerRole("PractitionerRole", (PractitionerRole)resource);
42187    else if (resource instanceof Procedure)
42188      composeProcedure("Procedure", (Procedure)resource);
42189    else if (resource instanceof ProcedureRequest)
42190      composeProcedureRequest("ProcedureRequest", (ProcedureRequest)resource);
42191    else if (resource instanceof ProcessRequest)
42192      composeProcessRequest("ProcessRequest", (ProcessRequest)resource);
42193    else if (resource instanceof ProcessResponse)
42194      composeProcessResponse("ProcessResponse", (ProcessResponse)resource);
42195    else if (resource instanceof Provenance)
42196      composeProvenance("Provenance", (Provenance)resource);
42197    else if (resource instanceof Questionnaire)
42198      composeQuestionnaire("Questionnaire", (Questionnaire)resource);
42199    else if (resource instanceof QuestionnaireResponse)
42200      composeQuestionnaireResponse("QuestionnaireResponse", (QuestionnaireResponse)resource);
42201    else if (resource instanceof ReferralRequest)
42202      composeReferralRequest("ReferralRequest", (ReferralRequest)resource);
42203    else if (resource instanceof RelatedPerson)
42204      composeRelatedPerson("RelatedPerson", (RelatedPerson)resource);
42205    else if (resource instanceof RequestGroup)
42206      composeRequestGroup("RequestGroup", (RequestGroup)resource);
42207    else if (resource instanceof ResearchStudy)
42208      composeResearchStudy("ResearchStudy", (ResearchStudy)resource);
42209    else if (resource instanceof ResearchSubject)
42210      composeResearchSubject("ResearchSubject", (ResearchSubject)resource);
42211    else if (resource instanceof RiskAssessment)
42212      composeRiskAssessment("RiskAssessment", (RiskAssessment)resource);
42213    else if (resource instanceof Schedule)
42214      composeSchedule("Schedule", (Schedule)resource);
42215    else if (resource instanceof SearchParameter)
42216      composeSearchParameter("SearchParameter", (SearchParameter)resource);
42217    else if (resource instanceof Sequence)
42218      composeSequence("Sequence", (Sequence)resource);
42219    else if (resource instanceof ServiceDefinition)
42220      composeServiceDefinition("ServiceDefinition", (ServiceDefinition)resource);
42221    else if (resource instanceof Slot)
42222      composeSlot("Slot", (Slot)resource);
42223    else if (resource instanceof Specimen)
42224      composeSpecimen("Specimen", (Specimen)resource);
42225    else if (resource instanceof StructureDefinition)
42226      composeStructureDefinition("StructureDefinition", (StructureDefinition)resource);
42227    else if (resource instanceof StructureMap)
42228      composeStructureMap("StructureMap", (StructureMap)resource);
42229    else if (resource instanceof Subscription)
42230      composeSubscription("Subscription", (Subscription)resource);
42231    else if (resource instanceof Substance)
42232      composeSubstance("Substance", (Substance)resource);
42233    else if (resource instanceof SupplyDelivery)
42234      composeSupplyDelivery("SupplyDelivery", (SupplyDelivery)resource);
42235    else if (resource instanceof SupplyRequest)
42236      composeSupplyRequest("SupplyRequest", (SupplyRequest)resource);
42237    else if (resource instanceof Task)
42238      composeTask("Task", (Task)resource);
42239    else if (resource instanceof TestReport)
42240      composeTestReport("TestReport", (TestReport)resource);
42241    else if (resource instanceof TestScript)
42242      composeTestScript("TestScript", (TestScript)resource);
42243    else if (resource instanceof ValueSet)
42244      composeValueSet("ValueSet", (ValueSet)resource);
42245    else if (resource instanceof VisionPrescription)
42246      composeVisionPrescription("VisionPrescription", (VisionPrescription)resource);
42247    else if (resource instanceof Binary)
42248      composeBinary("Binary", (Binary)resource);
42249    else
42250      throw new Error("Unhandled resource type "+resource.getClass().getName());
42251  }
42252
42253  protected void composeNamedReference(String name, Resource resource) throws IOException {
42254    if (resource instanceof Parameters)
42255      composeParameters(name, (Parameters)resource);
42256    else if (resource instanceof Account)
42257      composeAccount(name, (Account)resource);
42258    else if (resource instanceof ActivityDefinition)
42259      composeActivityDefinition(name, (ActivityDefinition)resource);
42260    else if (resource instanceof AdverseEvent)
42261      composeAdverseEvent(name, (AdverseEvent)resource);
42262    else if (resource instanceof AllergyIntolerance)
42263      composeAllergyIntolerance(name, (AllergyIntolerance)resource);
42264    else if (resource instanceof Appointment)
42265      composeAppointment(name, (Appointment)resource);
42266    else if (resource instanceof AppointmentResponse)
42267      composeAppointmentResponse(name, (AppointmentResponse)resource);
42268    else if (resource instanceof AuditEvent)
42269      composeAuditEvent(name, (AuditEvent)resource);
42270    else if (resource instanceof Basic)
42271      composeBasic(name, (Basic)resource);
42272    else if (resource instanceof Binary)
42273      composeBinary(name, (Binary)resource);
42274    else if (resource instanceof BodySite)
42275      composeBodySite(name, (BodySite)resource);
42276    else if (resource instanceof Bundle)
42277      composeBundle(name, (Bundle)resource);
42278    else if (resource instanceof CapabilityStatement)
42279      composeCapabilityStatement(name, (CapabilityStatement)resource);
42280    else if (resource instanceof CarePlan)
42281      composeCarePlan(name, (CarePlan)resource);
42282    else if (resource instanceof CareTeam)
42283      composeCareTeam(name, (CareTeam)resource);
42284    else if (resource instanceof ChargeItem)
42285      composeChargeItem(name, (ChargeItem)resource);
42286    else if (resource instanceof Claim)
42287      composeClaim(name, (Claim)resource);
42288    else if (resource instanceof ClaimResponse)
42289      composeClaimResponse(name, (ClaimResponse)resource);
42290    else if (resource instanceof ClinicalImpression)
42291      composeClinicalImpression(name, (ClinicalImpression)resource);
42292    else if (resource instanceof CodeSystem)
42293      composeCodeSystem(name, (CodeSystem)resource);
42294    else if (resource instanceof Communication)
42295      composeCommunication(name, (Communication)resource);
42296    else if (resource instanceof CommunicationRequest)
42297      composeCommunicationRequest(name, (CommunicationRequest)resource);
42298    else if (resource instanceof CompartmentDefinition)
42299      composeCompartmentDefinition(name, (CompartmentDefinition)resource);
42300    else if (resource instanceof Composition)
42301      composeComposition(name, (Composition)resource);
42302    else if (resource instanceof ConceptMap)
42303      composeConceptMap(name, (ConceptMap)resource);
42304    else if (resource instanceof Condition)
42305      composeCondition(name, (Condition)resource);
42306    else if (resource instanceof Consent)
42307      composeConsent(name, (Consent)resource);
42308    else if (resource instanceof Contract)
42309      composeContract(name, (Contract)resource);
42310    else if (resource instanceof Coverage)
42311      composeCoverage(name, (Coverage)resource);
42312    else if (resource instanceof DataElement)
42313      composeDataElement(name, (DataElement)resource);
42314    else if (resource instanceof DetectedIssue)
42315      composeDetectedIssue(name, (DetectedIssue)resource);
42316    else if (resource instanceof Device)
42317      composeDevice(name, (Device)resource);
42318    else if (resource instanceof DeviceComponent)
42319      composeDeviceComponent(name, (DeviceComponent)resource);
42320    else if (resource instanceof DeviceMetric)
42321      composeDeviceMetric(name, (DeviceMetric)resource);
42322    else if (resource instanceof DeviceRequest)
42323      composeDeviceRequest(name, (DeviceRequest)resource);
42324    else if (resource instanceof DeviceUseStatement)
42325      composeDeviceUseStatement(name, (DeviceUseStatement)resource);
42326    else if (resource instanceof DiagnosticReport)
42327      composeDiagnosticReport(name, (DiagnosticReport)resource);
42328    else if (resource instanceof DocumentManifest)
42329      composeDocumentManifest(name, (DocumentManifest)resource);
42330    else if (resource instanceof DocumentReference)
42331      composeDocumentReference(name, (DocumentReference)resource);
42332    else if (resource instanceof EligibilityRequest)
42333      composeEligibilityRequest(name, (EligibilityRequest)resource);
42334    else if (resource instanceof EligibilityResponse)
42335      composeEligibilityResponse(name, (EligibilityResponse)resource);
42336    else if (resource instanceof Encounter)
42337      composeEncounter(name, (Encounter)resource);
42338    else if (resource instanceof Endpoint)
42339      composeEndpoint(name, (Endpoint)resource);
42340    else if (resource instanceof EnrollmentRequest)
42341      composeEnrollmentRequest(name, (EnrollmentRequest)resource);
42342    else if (resource instanceof EnrollmentResponse)
42343      composeEnrollmentResponse(name, (EnrollmentResponse)resource);
42344    else if (resource instanceof EpisodeOfCare)
42345      composeEpisodeOfCare(name, (EpisodeOfCare)resource);
42346    else if (resource instanceof ExpansionProfile)
42347      composeExpansionProfile(name, (ExpansionProfile)resource);
42348    else if (resource instanceof ExplanationOfBenefit)
42349      composeExplanationOfBenefit(name, (ExplanationOfBenefit)resource);
42350    else if (resource instanceof FamilyMemberHistory)
42351      composeFamilyMemberHistory(name, (FamilyMemberHistory)resource);
42352    else if (resource instanceof Flag)
42353      composeFlag(name, (Flag)resource);
42354    else if (resource instanceof Goal)
42355      composeGoal(name, (Goal)resource);
42356    else if (resource instanceof GraphDefinition)
42357      composeGraphDefinition(name, (GraphDefinition)resource);
42358    else if (resource instanceof Group)
42359      composeGroup(name, (Group)resource);
42360    else if (resource instanceof GuidanceResponse)
42361      composeGuidanceResponse(name, (GuidanceResponse)resource);
42362    else if (resource instanceof HealthcareService)
42363      composeHealthcareService(name, (HealthcareService)resource);
42364    else if (resource instanceof ImagingManifest)
42365      composeImagingManifest(name, (ImagingManifest)resource);
42366    else if (resource instanceof ImagingStudy)
42367      composeImagingStudy(name, (ImagingStudy)resource);
42368    else if (resource instanceof Immunization)
42369      composeImmunization(name, (Immunization)resource);
42370    else if (resource instanceof ImmunizationRecommendation)
42371      composeImmunizationRecommendation(name, (ImmunizationRecommendation)resource);
42372    else if (resource instanceof ImplementationGuide)
42373      composeImplementationGuide(name, (ImplementationGuide)resource);
42374    else if (resource instanceof Library)
42375      composeLibrary(name, (Library)resource);
42376    else if (resource instanceof Linkage)
42377      composeLinkage(name, (Linkage)resource);
42378    else if (resource instanceof ListResource)
42379      composeListResource(name, (ListResource)resource);
42380    else if (resource instanceof Location)
42381      composeLocation(name, (Location)resource);
42382    else if (resource instanceof Measure)
42383      composeMeasure(name, (Measure)resource);
42384    else if (resource instanceof MeasureReport)
42385      composeMeasureReport(name, (MeasureReport)resource);
42386    else if (resource instanceof Media)
42387      composeMedia(name, (Media)resource);
42388    else if (resource instanceof Medication)
42389      composeMedication(name, (Medication)resource);
42390    else if (resource instanceof MedicationAdministration)
42391      composeMedicationAdministration(name, (MedicationAdministration)resource);
42392    else if (resource instanceof MedicationDispense)
42393      composeMedicationDispense(name, (MedicationDispense)resource);
42394    else if (resource instanceof MedicationRequest)
42395      composeMedicationRequest(name, (MedicationRequest)resource);
42396    else if (resource instanceof MedicationStatement)
42397      composeMedicationStatement(name, (MedicationStatement)resource);
42398    else if (resource instanceof MessageDefinition)
42399      composeMessageDefinition(name, (MessageDefinition)resource);
42400    else if (resource instanceof MessageHeader)
42401      composeMessageHeader(name, (MessageHeader)resource);
42402    else if (resource instanceof NamingSystem)
42403      composeNamingSystem(name, (NamingSystem)resource);
42404    else if (resource instanceof NutritionOrder)
42405      composeNutritionOrder(name, (NutritionOrder)resource);
42406    else if (resource instanceof Observation)
42407      composeObservation(name, (Observation)resource);
42408    else if (resource instanceof OperationDefinition)
42409      composeOperationDefinition(name, (OperationDefinition)resource);
42410    else if (resource instanceof OperationOutcome)
42411      composeOperationOutcome(name, (OperationOutcome)resource);
42412    else if (resource instanceof Organization)
42413      composeOrganization(name, (Organization)resource);
42414    else if (resource instanceof Patient)
42415      composePatient(name, (Patient)resource);
42416    else if (resource instanceof PaymentNotice)
42417      composePaymentNotice(name, (PaymentNotice)resource);
42418    else if (resource instanceof PaymentReconciliation)
42419      composePaymentReconciliation(name, (PaymentReconciliation)resource);
42420    else if (resource instanceof Person)
42421      composePerson(name, (Person)resource);
42422    else if (resource instanceof PlanDefinition)
42423      composePlanDefinition(name, (PlanDefinition)resource);
42424    else if (resource instanceof Practitioner)
42425      composePractitioner(name, (Practitioner)resource);
42426    else if (resource instanceof PractitionerRole)
42427      composePractitionerRole(name, (PractitionerRole)resource);
42428    else if (resource instanceof Procedure)
42429      composeProcedure(name, (Procedure)resource);
42430    else if (resource instanceof ProcedureRequest)
42431      composeProcedureRequest(name, (ProcedureRequest)resource);
42432    else if (resource instanceof ProcessRequest)
42433      composeProcessRequest(name, (ProcessRequest)resource);
42434    else if (resource instanceof ProcessResponse)
42435      composeProcessResponse(name, (ProcessResponse)resource);
42436    else if (resource instanceof Provenance)
42437      composeProvenance(name, (Provenance)resource);
42438    else if (resource instanceof Questionnaire)
42439      composeQuestionnaire(name, (Questionnaire)resource);
42440    else if (resource instanceof QuestionnaireResponse)
42441      composeQuestionnaireResponse(name, (QuestionnaireResponse)resource);
42442    else if (resource instanceof ReferralRequest)
42443      composeReferralRequest(name, (ReferralRequest)resource);
42444    else if (resource instanceof RelatedPerson)
42445      composeRelatedPerson(name, (RelatedPerson)resource);
42446    else if (resource instanceof RequestGroup)
42447      composeRequestGroup(name, (RequestGroup)resource);
42448    else if (resource instanceof ResearchStudy)
42449      composeResearchStudy(name, (ResearchStudy)resource);
42450    else if (resource instanceof ResearchSubject)
42451      composeResearchSubject(name, (ResearchSubject)resource);
42452    else if (resource instanceof RiskAssessment)
42453      composeRiskAssessment(name, (RiskAssessment)resource);
42454    else if (resource instanceof Schedule)
42455      composeSchedule(name, (Schedule)resource);
42456    else if (resource instanceof SearchParameter)
42457      composeSearchParameter(name, (SearchParameter)resource);
42458    else if (resource instanceof Sequence)
42459      composeSequence(name, (Sequence)resource);
42460    else if (resource instanceof ServiceDefinition)
42461      composeServiceDefinition(name, (ServiceDefinition)resource);
42462    else if (resource instanceof Slot)
42463      composeSlot(name, (Slot)resource);
42464    else if (resource instanceof Specimen)
42465      composeSpecimen(name, (Specimen)resource);
42466    else if (resource instanceof StructureDefinition)
42467      composeStructureDefinition(name, (StructureDefinition)resource);
42468    else if (resource instanceof StructureMap)
42469      composeStructureMap(name, (StructureMap)resource);
42470    else if (resource instanceof Subscription)
42471      composeSubscription(name, (Subscription)resource);
42472    else if (resource instanceof Substance)
42473      composeSubstance(name, (Substance)resource);
42474    else if (resource instanceof SupplyDelivery)
42475      composeSupplyDelivery(name, (SupplyDelivery)resource);
42476    else if (resource instanceof SupplyRequest)
42477      composeSupplyRequest(name, (SupplyRequest)resource);
42478    else if (resource instanceof Task)
42479      composeTask(name, (Task)resource);
42480    else if (resource instanceof TestReport)
42481      composeTestReport(name, (TestReport)resource);
42482    else if (resource instanceof TestScript)
42483      composeTestScript(name, (TestScript)resource);
42484    else if (resource instanceof ValueSet)
42485      composeValueSet(name, (ValueSet)resource);
42486    else if (resource instanceof VisionPrescription)
42487      composeVisionPrescription(name, (VisionPrescription)resource);
42488    else if (resource instanceof Binary)
42489      composeBinary(name, (Binary)resource);
42490    else
42491      throw new Error("Unhandled resource type "+resource.getClass().getName());
42492  }
42493
42494  protected void composeType(String prefix, Type type) throws IOException {
42495    if (type == null)
42496      ;
42497    else if (type instanceof SimpleQuantity)
42498       composeSimpleQuantity(prefix+"SimpleQuantity", (SimpleQuantity) type);
42499    else if (type instanceof Duration)
42500       composeDuration(prefix+"Duration", (Duration) type);
42501    else if (type instanceof Count)
42502       composeCount(prefix+"Count", (Count) type);
42503    else if (type instanceof Money)
42504       composeMoney(prefix+"Money", (Money) type);
42505    else if (type instanceof Distance)
42506       composeDistance(prefix+"Distance", (Distance) type);
42507    else if (type instanceof Age)
42508       composeAge(prefix+"Age", (Age) type);
42509    else if (type instanceof Reference)
42510       composeReference(prefix+"Reference", (Reference) type);
42511    else if (type instanceof Quantity)
42512       composeQuantity(prefix+"Quantity", (Quantity) type);
42513    else if (type instanceof Period)
42514       composePeriod(prefix+"Period", (Period) type);
42515    else if (type instanceof Attachment)
42516       composeAttachment(prefix+"Attachment", (Attachment) type);
42517    else if (type instanceof Range)
42518       composeRange(prefix+"Range", (Range) type);
42519    else if (type instanceof Annotation)
42520       composeAnnotation(prefix+"Annotation", (Annotation) type);
42521    else if (type instanceof Identifier)
42522       composeIdentifier(prefix+"Identifier", (Identifier) type);
42523    else if (type instanceof Coding)
42524       composeCoding(prefix+"Coding", (Coding) type);
42525    else if (type instanceof Signature)
42526       composeSignature(prefix+"Signature", (Signature) type);
42527    else if (type instanceof SampledData)
42528       composeSampledData(prefix+"SampledData", (SampledData) type);
42529    else if (type instanceof Ratio)
42530       composeRatio(prefix+"Ratio", (Ratio) type);
42531    else if (type instanceof CodeableConcept)
42532       composeCodeableConcept(prefix+"CodeableConcept", (CodeableConcept) type);
42533    else if (type instanceof Meta)
42534       composeMeta(prefix+"Meta", (Meta) type);
42535    else if (type instanceof Address)
42536       composeAddress(prefix+"Address", (Address) type);
42537    else if (type instanceof TriggerDefinition)
42538       composeTriggerDefinition(prefix+"TriggerDefinition", (TriggerDefinition) type);
42539    else if (type instanceof Contributor)
42540       composeContributor(prefix+"Contributor", (Contributor) type);
42541    else if (type instanceof DataRequirement)
42542       composeDataRequirement(prefix+"DataRequirement", (DataRequirement) type);
42543    else if (type instanceof Dosage)
42544       composeDosage(prefix+"Dosage", (Dosage) type);
42545    else if (type instanceof RelatedArtifact)
42546       composeRelatedArtifact(prefix+"RelatedArtifact", (RelatedArtifact) type);
42547    else if (type instanceof ContactDetail)
42548       composeContactDetail(prefix+"ContactDetail", (ContactDetail) type);
42549    else if (type instanceof HumanName)
42550       composeHumanName(prefix+"HumanName", (HumanName) type);
42551    else if (type instanceof ContactPoint)
42552       composeContactPoint(prefix+"ContactPoint", (ContactPoint) type);
42553    else if (type instanceof UsageContext)
42554       composeUsageContext(prefix+"UsageContext", (UsageContext) type);
42555    else if (type instanceof Timing)
42556       composeTiming(prefix+"Timing", (Timing) type);
42557    else if (type instanceof ElementDefinition)
42558       composeElementDefinition(prefix+"ElementDefinition", (ElementDefinition) type);
42559    else if (type instanceof ParameterDefinition)
42560       composeParameterDefinition(prefix+"ParameterDefinition", (ParameterDefinition) type);
42561    else if (type instanceof CodeType) {
42562      composeCodeCore(prefix+"Code", (CodeType) type, false);
42563      composeCodeExtras(prefix+"Code", (CodeType) type, false);
42564    }
42565    else if (type instanceof OidType) {
42566      composeOidCore(prefix+"Oid", (OidType) type, false);
42567      composeOidExtras(prefix+"Oid", (OidType) type, false);
42568    }
42569    else if (type instanceof UuidType) {
42570      composeUuidCore(prefix+"Uuid", (UuidType) type, false);
42571      composeUuidExtras(prefix+"Uuid", (UuidType) type, false);
42572    }
42573    else if (type instanceof UnsignedIntType) {
42574      composeUnsignedIntCore(prefix+"UnsignedInt", (UnsignedIntType) type, false);
42575      composeUnsignedIntExtras(prefix+"UnsignedInt", (UnsignedIntType) type, false);
42576    }
42577    else if (type instanceof MarkdownType) {
42578      composeMarkdownCore(prefix+"Markdown", (MarkdownType) type, false);
42579      composeMarkdownExtras(prefix+"Markdown", (MarkdownType) type, false);
42580    }
42581    else if (type instanceof IdType) {
42582      composeIdCore(prefix+"Id", (IdType) type, false);
42583      composeIdExtras(prefix+"Id", (IdType) type, false);
42584    }
42585    else if (type instanceof PositiveIntType) {
42586      composePositiveIntCore(prefix+"PositiveInt", (PositiveIntType) type, false);
42587      composePositiveIntExtras(prefix+"PositiveInt", (PositiveIntType) type, false);
42588    }
42589    else if (type instanceof DateType) {
42590      composeDateCore(prefix+"Date", (DateType) type, false);
42591      composeDateExtras(prefix+"Date", (DateType) type, false);
42592    }
42593    else if (type instanceof DateTimeType) {
42594      composeDateTimeCore(prefix+"DateTime", (DateTimeType) type, false);
42595      composeDateTimeExtras(prefix+"DateTime", (DateTimeType) type, false);
42596    }
42597    else if (type instanceof StringType) {
42598      composeStringCore(prefix+"String", (StringType) type, false);
42599      composeStringExtras(prefix+"String", (StringType) type, false);
42600    }
42601    else if (type instanceof IntegerType) {
42602      composeIntegerCore(prefix+"Integer", (IntegerType) type, false);
42603      composeIntegerExtras(prefix+"Integer", (IntegerType) type, false);
42604    }
42605    else if (type instanceof UriType) {
42606      composeUriCore(prefix+"Uri", (UriType) type, false);
42607      composeUriExtras(prefix+"Uri", (UriType) type, false);
42608    }
42609    else if (type instanceof InstantType) {
42610      composeInstantCore(prefix+"Instant", (InstantType) type, false);
42611      composeInstantExtras(prefix+"Instant", (InstantType) type, false);
42612    }
42613    else if (type instanceof BooleanType) {
42614      composeBooleanCore(prefix+"Boolean", (BooleanType) type, false);
42615      composeBooleanExtras(prefix+"Boolean", (BooleanType) type, false);
42616    }
42617    else if (type instanceof Base64BinaryType) {
42618      composeBase64BinaryCore(prefix+"Base64Binary", (Base64BinaryType) type, false);
42619      composeBase64BinaryExtras(prefix+"Base64Binary", (Base64BinaryType) type, false);
42620    }
42621    else if (type instanceof TimeType) {
42622      composeTimeCore(prefix+"Time", (TimeType) type, false);
42623      composeTimeExtras(prefix+"Time", (TimeType) type, false);
42624    }
42625    else if (type instanceof DecimalType) {
42626      composeDecimalCore(prefix+"Decimal", (DecimalType) type, false);
42627      composeDecimalExtras(prefix+"Decimal", (DecimalType) type, false);
42628    }
42629    else
42630      throw new Error("Unhandled type");
42631  }
42632
42633  protected void composeTypeInner(Type type) throws IOException {
42634    if (type == null)
42635      ;
42636    else if (type instanceof Duration)
42637       composeDurationInner((Duration) type);
42638    else if (type instanceof Count)
42639       composeCountInner((Count) type);
42640    else if (type instanceof Money)
42641       composeMoneyInner((Money) type);
42642    else if (type instanceof Distance)
42643       composeDistanceInner((Distance) type);
42644    else if (type instanceof Age)
42645       composeAgeInner((Age) type);
42646    else if (type instanceof Reference)
42647       composeReferenceInner((Reference) type);
42648    else if (type instanceof Quantity)
42649       composeQuantityInner((Quantity) type);
42650    else if (type instanceof Period)
42651       composePeriodInner((Period) type);
42652    else if (type instanceof Attachment)
42653       composeAttachmentInner((Attachment) type);
42654    else if (type instanceof Range)
42655       composeRangeInner((Range) type);
42656    else if (type instanceof Annotation)
42657       composeAnnotationInner((Annotation) type);
42658    else if (type instanceof Identifier)
42659       composeIdentifierInner((Identifier) type);
42660    else if (type instanceof Coding)
42661       composeCodingInner((Coding) type);
42662    else if (type instanceof Signature)
42663       composeSignatureInner((Signature) type);
42664    else if (type instanceof SampledData)
42665       composeSampledDataInner((SampledData) type);
42666    else if (type instanceof Ratio)
42667       composeRatioInner((Ratio) type);
42668    else if (type instanceof CodeableConcept)
42669       composeCodeableConceptInner((CodeableConcept) type);
42670    else if (type instanceof SimpleQuantity)
42671       composeSimpleQuantityInner((SimpleQuantity) type);
42672    else if (type instanceof Meta)
42673       composeMetaInner((Meta) type);
42674    else if (type instanceof Address)
42675       composeAddressInner((Address) type);
42676    else if (type instanceof TriggerDefinition)
42677       composeTriggerDefinitionInner((TriggerDefinition) type);
42678    else if (type instanceof Contributor)
42679       composeContributorInner((Contributor) type);
42680    else if (type instanceof DataRequirement)
42681       composeDataRequirementInner((DataRequirement) type);
42682    else if (type instanceof Dosage)
42683       composeDosageInner((Dosage) type);
42684    else if (type instanceof RelatedArtifact)
42685       composeRelatedArtifactInner((RelatedArtifact) type);
42686    else if (type instanceof ContactDetail)
42687       composeContactDetailInner((ContactDetail) type);
42688    else if (type instanceof HumanName)
42689       composeHumanNameInner((HumanName) type);
42690    else if (type instanceof ContactPoint)
42691       composeContactPointInner((ContactPoint) type);
42692    else if (type instanceof UsageContext)
42693       composeUsageContextInner((UsageContext) type);
42694    else if (type instanceof Timing)
42695       composeTimingInner((Timing) type);
42696    else if (type instanceof ElementDefinition)
42697       composeElementDefinitionInner((ElementDefinition) type);
42698    else if (type instanceof ParameterDefinition)
42699       composeParameterDefinitionInner((ParameterDefinition) type);
42700    else
42701      throw new Error("Unhandled type");
42702  }
42703
42704}